0

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"/>

1
  • 1
    It would be easier if you posted your layout file. Commented Feb 22, 2011 at 5:45

2 Answers 2

1

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>
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.