Reputation: 543
I am trying to add a button below a GridView
. I tried using RelativeLayout
and LinearLayout
as well. But button does not appear. The height of the GridView
is also "wrap_content"
. The button appears behind the GridView
.
How do place it below the grid ?
The following is my layout that doesnt work
<GridView android:id = "@+id/galleryGridView" android:layout_width = "wrap_content" android:layout_height = "wrap_content"
android:padding = "1dip" android:verticalSpacing = "1dip" android:horizontalSpacing = "1dip" android:columnWidth = "90dip"
android:paddingBottom = "1dip" android:numColumns = "auto_fit" android:stretchMode = "columnWidth" android:gravity = "center"/>
<Button android:id = "@+id/loadMoreButton" android:layout_width = "fill_parent" android:layout_height = "fill_parent"
android:text = "Load More" android:layout_below = "@id/galleryGridView"/>
Upvotes: 0
Views: 3291
Reputation: 15340
wrap it in a linear layout with vertical orientation similar to the following:
<LinearLayout android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="fill_parent" >
<GridView .... />
<Button .... />
</LinearLayout>
Upvotes: 1
Reputation: 536
have a look at this link: http://developer.android.com/resources/tutorials/views/hello-relativelayout.html
i bet you forgot to add android:layout_below="@id/your_grid_id_here" attribute for a button
Upvotes: 0