开发者

Adding the button below a GridView

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


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>


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜