我需要做什么特殊的事情才能使文本在<TableLayout>
?
下面的简单示例似乎将文本右边缘对齐在屏幕中心,几乎就像layout_span
没有效果。
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
>
<TableRow>
<TextView
android:text="Some text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_span="2"
/>
</TableRow>
<TableRow>
<Button
android:text="Button 1"
android:layout_weight="50"/>
<Button
android:text="Button 2"
android:layout_weight="50"/>
</TableRow>
</TableLayout>
Fixed.
从 TextView 中删除的部分:
android:layout_gravity="right"
android:layout_span="2"
TextView 中的更新部分:
android:gravity="right"
android:layout_weight="1.0"
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent" >
<TableRow>
<TextView
android:text="Some text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_weight="1.0" />
</TableRow>
<TableRow>
<Button
android:text="Button 1"
android:layout_weight="50"/>
<Button
android:text="Button 2"
android:layout_weight="50"/>
</TableRow>
</TableLayout>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)