开发者

UI - How to display GridView and Linear layout togather

I want to display GridView (with text and image) and group of text box below grid view.

Problem is my gridview do not have fixed entries. It is varying between 1 & 10. I want to resize it as per count of items in grid view. How can i do that? Where can i get height of gridview in JAVA code?

Also, i want to display my group of text boxes ALWAYS at bottom of activity. How can i 开发者_开发知识库do that?





   
 
 
 

Thanks, JC


I want to resize it as per count of items in grid view.

I really don't recommend that.

Also, i want to display my group of text boxes ALWAYS at bottom of activity. How can i do that?

Step #1: Put the GridView and the LinearLayout inside a RelativeLayout

Step #2: Anchor the LinearLayout to the bottom via android:layout_alignParentBottom="true"

Step #3: Anchor the GridView to the top (android:layout_alignParentTop="true") and to the top of the LinearLayout (android:layout_above="...")

This will cause your GridView to expand to fill the space in the RelativeLayout except that which is taken up by the LinearLayout at the bottom. You can size and position the RelativeLayout yourself as you see fit (e.g., set width and height to fill_parent to have it fill the screen).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜