我想在安卓中将文本对齐到左下角。
我想在安卓中将文本对齐到左下角。
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>
<?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>
android:layout_alignParentBottom="true" android:layout_alignParentLeft="true"
必须写在TextView中。