如何在android中对齐文本
答
如果要将TextView中的文本与左下角对齐,请使用android:gravity="bottom|left"
。如果要将TextView对齐其容器的左下角,请使用android:layout_gravity="bottom|left"
。
尽管如此,我怀疑你是在误传你的真实意图。你想将某些文字对齐左下角的内容?屏幕?文本的容器?
请尝试更具体地处理您的问题。
屏幕左下方的:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="bottom|left"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text"/>
</FrameLayout>
答
我会建议Relative layout。
您的看法是这样的:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text aligned bottom left"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
您有什么看法XML目前? – jball 2010-05-01 17:16:28
你有什么代码,你用的是什么样的xml看起来像atm? – wheaties 2010-11-21 16:21:35