机器人TableLayout宽度 [英] Android TableLayout Width

查看:159
本文介绍了机器人TableLayout宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个两列TableLayout作为滚动视图的唯一的孩子。第一列包含TextViews('标签')和第二列包含的EditText /微调/ DateWidget等(价值)。即使我已经有指定的机器人:layout_width =FILL_PARENT为TableLayout,的TableRow和放大器;所有小工具(在价值列)。

I have a two column TableLayout as the only child of a scroll view. The first column contains TextViews ('labels') and the second column contains EditText/Spinner/DateWidget etc ('values'). Even though I have have specified android:layout_width="fill_parent" for TableLayout, TableRow & all widgets (in 'values' column).

在创建活动时,屏幕看起来很完美。但是,如果在EditText上1种很长的值,在值列超出可视屏幕区域。

The screen looks perfect when the activity is created. However, when one types a really long value in the EditText, the 'values' column goes beyond the visible screen area.

我要如何解决呢?

感谢

推荐答案

您可能希望通过使用权重来定义列的大小。所以,你会定义表格布局的高度,以填补父,但是对于每个列,你可以应设置宽度为0px​​,重到你想要的列跨越的百分比。因此,假如要在第一列是屏幕宽度的20%的设置它的重量为0.2,第二列到0.8。

You may want to define the sizes of the columns by using a weight. So you will define the table layout height to fill parent but for each column you can should set the width to "0px" and the weight to the percentage you want the column to span. So assuming you want the first column to be 20% of the screen width you set it's weight to "0.2" and the second column to "0.8".

试一试,看看是否可行。

Try it and see if that works.

这篇关于机器人TableLayout宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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