由网友(世界不在我眼里)分享简介:有没有什么特别的,我需要做的就是在对齐文本权< TableLayout> 下面这个简单的例子似乎右对齐边在屏幕中央的文字,仿佛 layout_span 无影响。< TableLayout的xmlns:机器人=http://schemas.android.com/apk/res/android机器...
有没有什么特别的,我需要做的就是在对齐文本权< TableLayout>
下面这个简单的例子似乎右对齐边在屏幕中央的文字,仿佛 layout_span
无影响。
< TableLayout
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_height =FILL_PARENT
机器人:layout_width =FILL_PARENT
>
<的TableRow>
<的TextView
机器人:文本=一些文本
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_gravity =右
机器人:layout_span =2
/>
< /的TableRow>
<的TableRow>
<按钮
机器人:文本=按钮1
机器人:layout_weight =50/>
<按钮
机器人:文本=按钮2
机器人:layout_weight =50/>
< /的TableRow>
< / TableLayout>
解决方案
修正。
删除了TextView的部分:
安卓layout_gravity =右
机器人:layout_span =2
在TextView中的更新部分:
安卓重力=右
机器人:layout_weight =1.0
< TableLayout的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_height =FILL_PARENT
机器人:layout_width =FILL_PARENT>
<的TableRow>
<的TextView
机器人:文本=一些文本
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:重力=右
机器人:layout_weight =1.0/>
< /的TableRow>
<的TableRow>
<按钮
机器人:文本=按钮1
机器人:layout_weight =50/>
<按钮
机器人:文本=按钮2
机器人:layout_weight =50/>
< /的TableRow>
< / TableLayout>
Is there anything special I need to do to get text right aligned in a <TableLayout>
?
The following simple example seems to align the text right-edged on the center of the screen, almost as if layout_span
had no effect.
<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.
Removed Portion from TextView :
android:layout_gravity="right"
android:layout_span="2"
Updated Portion in 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>
相关推荐
最新文章