在我的活动中我定义了 3 个 textView 控件。
所有这些 textView 都一个挨着一个出现 - 我需要做一些事情,使它们始终具有相同的大小。假设第一个 textView 控件是小时,第二个 textView 控件是分钟,第三个 textView 控件是秒。
所以我想全屏显示它们,并且所有 textView 控件都需要具有相同的大小。
怎么做 ?
如果它们放置在线性布局中,方向水平,宽度和高度换行内容,并且它们使用相同的文本主题样式,则不需要 Weightsum。
此外,通过包装文本视图的容器布局的宽度和高度,这不会强制视图填充除文本视图所需的任何特定空间。
请注意,线性布局位于视图布局内。
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hh:"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="mm:"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ss"/>
</LinearLayout>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)