tags:

views:

39

answers:

2

Currently I have a list view within it each row has a checkbox attached. I would like that once any checkbox is checked, at the bottom of the screen a view displays, and once none of the checkboxes are checked, the view automatically disappeared. Possible to do this?

Any help or direction is appreciated. Thank you.

A: 

Yeah, you can do it.

Sounds like what you're looking for is a floating view at the bottom...

Try this example:

<?xml version="1.0" encoding="UTF-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

  <LinearLayout android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">

    <ListView android:id="@android:id/list"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"/>
    <TextView android:id="@android:id/empty"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:text="@string/no_notes"/>

  </LinearLayout>

  <Button android:id="@+id/floating_button"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Floating Button"
              android:padding="5dip"
              android:layout_margin="5dip"
              android:layout_gravity="right|bottom" />
</FrameLayout>

In this example I used a button at the bottom, but you an use any view.

And to hide it you can use android:visibility or setVisibility(int visibility)

Hope that helped...

xil3
Also, that View (button in this case) will scroll along with your listview.
xil3
This won't work - FrameLayout can hold only one child View
ognian
Yeah, it can, but any subsequent child views added float over top the previous. I've already tested it and it works just fine.
xil3
I tried this. I works and the effect is pretty much what I am looking for. Thank you for the help.
Azu
A: 

You will need to use a counter and couple it with addFooterView & removeFooterView.

When ever a checkbox is checked you need to update the counter in the onclicklistener for the checkbox and depending on the value of the counter add or remove the footer view.

Ravi Vyas