how to add text in grid view end
I am using gridview for displaying images. Initially I am displaying 16 images in the gridview and next I want to display 32 images in the gridview.
I want a next button at the bottom of the grid view to go to the next set of images.
How can I set button at the 开发者_高级运维bottom of a gridview for Android?
If you really need a "button" at the bottom of the GridView, here is the layout that you have to design in your loading XML file.
<GridView
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:numColumns="3" >
</GridView>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Button" />
</RelativeLayout>
For lesser grids it will be OK. If your have grids more than that your screen can show, you will get a display like this (click here)
Now you can write for the OnClickListner of the button.
BUT what I am suggesting you is, use a customize menu to put that button. Then you don't have any overlapping issue if there are so many grid items in your Activity.
Good luck
精彩评论