Bottom button bar overlaps the last element of Listview!!
Posted
by
elto
on Stack Overflow
See other posts from Stack Overflow
or by elto
Published on 2011-01-05T08:07:51Z
Indexed on
2011/01/05
8:53 UTC
Read the original article
Hit count: 458
I have a listview which is part of an Activity. I want user to have a choice for batch deleting the items in the listview, so when he chooses the corresponding option from the menu, every list item gets a checkbox next to it. When user clicks any checkbox, a button bar is to slide up from bottom (as in gmail app) and clicking delete button deletes the selected items, however clicking cancel button on the bar would uncheck all the checked items.
This is my page layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent"
>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/list_area"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
>
<ListView
android:id="@+id/mylist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:drawSelectorOnTop="false"
android:layout_weight="1"
/>
<TextView
android:id="@+id/empty_list_message"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:layout_gravity="center_vertical|center_horizontal"
android:text="@string/msg_for_emptyschd"
android:layout_margin="14dip"
android:layout_weight="1"
/>
</LinearLayout>
<RelativeLayout
android:id="@+id/bottom_action_bar"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/schedule_bottom_actionbar_border"
android:layout_marginBottom="2dip"
android:layout_gravity="bottom"
android:visibility="gone"
>
<Button
android:id="@+id/delete_selecteditems_button"
android:text="Deleted Selected"
android:layout_width="140dip"
android:layout_height="40dip"
android:layout_alignParentLeft="true"
android:layout_marginLeft="3dip"
android:layout_marginTop="3dip"
/>
<Button
android:id="@+id/cancel_button"
android:text="Cancel"
android:layout_width="140dip"
android:layout_height="40dip"
android:layout_alignParentRight="true"
android:layout_marginRight="3dip"
android:layout_marginTop="3dip"
/>
</RelativeLayout>
</FrameLayout>
</LinearLayout>
so far, I have got everything working except that when the bottom bar becomes visible upon checkbox selection, it overlaps the last element of the list. All other list items can be scrolled up, but you cant scroll up the very last item of the list, therefore user can not select that item if he intends to. Here is the screenshot of the overlap.
I have tried using the listview footer option, but that appends the bar to the end of the list instead of keeping it fixed at the bottom of the screen. Is there a way I could "raise" the listview enough so that the overlap wont happen?? BTW, I have already tried adding the bottom-margin to the listview itself, or the LinearLayout wrapping the listview right before making the button-bar visible, but it introduces other bugs like clicking one checkbox checks some another checkbox in listview.
© Stack Overflow or respective owner