UI - 如何togather显示GridView和线性布局 [英] UI - How to display GridView and Linear layout togather
问题描述
我要显示的GridView(文字和图片)下方网格视图文本框和组。
问题是我的GridView没有固定的条目。这是1安培之间变化; 10.我想调整它的大小根据网格视图中的项目数。我怎样才能做到这一点?我在哪里可以得到的GridView的高度JAVA code?
另外,我想总是在活动的底部显示我的组文本框。我该怎么做?
谢谢,
JC
我想调整它的大小根据网格视图中的项目数量。
块引用>我真的不推荐。
另外,我想总是在活动的底部显示我的组文本框。我该怎么做?
块引用>第1步:把
GridView控件
和的LinearLayout
在RelativeLayout的
第二步:layout_alignParentBottom =真正的
Android的锚的LinearLayout
的底部>第三步:锚的
GridView控件
顶端(的android:layout_alignParentTop =真正的
)和顶部的的LinearLayout
(的android:layout_above =...
)这会使你的
GridView控件
扩大填写RelativeLayout的
的空间,只是这是采取了由在的LinearLayout
在底部。您可以大小和位置RelativeLayout的
你自己,你认为合适(例如,设置宽度和高度FILL_PARENT
有它充满整个屏幕)。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 theLinearLayout
inside aRelativeLayout
Step #2: Anchor the
LinearLayout
to the bottom viaandroid:layout_alignParentBottom="true"
Step #3: Anchor the
GridView
to the top (android:layout_alignParentTop="true"
) and to the top of theLinearLayout
(android:layout_above="..."
)This will cause your
GridView
to expand to fill the space in theRelativeLayout
except that which is taken up by theLinearLayout
at the bottom. You can size and position theRelativeLayout
yourself as you see fit (e.g., set width and height tofill_parent
to have it fill the screen).这篇关于UI - 如何togather显示GridView和线性布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!