UI - 如何togather显示GridView和线性布局 [英] UI - How to display GridView and Linear layout togather

查看:112
本文介绍了UI - 如何togather显示GridView和线性布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示的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 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).

这篇关于UI - 如何togather显示GridView和线性布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆