My goal is to have a sticky header, a clear button, and then a ListView (in that order).
+-----------------+
| Header | (Sticky)
+-----------------+
| "Clear" button | (NOT sticky)
+-----------------+
| ListView | (Also NOT sticky)
| |
| |
| |
| |
| |
| |
+-----------------+
This following approach almost does what I want. The header is sticky, and the ListView functions correctly. But the button is sticky (it tags along right below the sticky header).
<RelativeLayout>
<!-- Used for Sticky Header -->
<RelativeLayout
android:id="@+id/top_control_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize">
<Button/>
<TextView/>
</RelativeLayout> <!-- End XML for sticky hader -->
<!-- Button to clear bookmarks -->
<Button
android:id="@+id/clearButton"
android:text="CLEAR"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_below="@+id/top_control_bar"
android:onClick="clearBookmarks"/>
<!-- ListView for displaying questions -->
<ListView
android:id="@+id/listViewBrowse"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/clearButton" >
</ListView>
</RelativeLayout>
I think I need to stop using this property
android:layout_below="@+id/top_control_bar"
for the "clear" button. But it doesn't work if I just get rid of it (the button overlays the header if I do that). What should I adjust? Or what should I try instead of this approach?
Aucun commentaire:
Enregistrer un commentaire