Ste*_*all 11 java layout android tableview
我需要做些什么特别的事情才能使文本在对齐中对齐<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>
Run Code Online (Sandbox Code Playgroud)
Kar*_*iya 29
固定.
从TextView中删除了部分:
android:layout_gravity="right"
android:layout_span="2"
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25122 次 |
| 最近记录: |