如何在android中设置文本方向
我有一个文本视图,我在其中设置了波斯语/阿拉伯语文本,并将重力设置为右侧,但在平板电脑中,它将文本显示为左侧。如果将重力设置为左侧,则将其显示为右侧。在它成为真值之前,我该怎么做如何在android中设置文本方向,android,Android,我有一个文本视图,我在其中设置了波斯语/阿拉伯语文本,并将重力设置为右侧,但在平板电脑中,它将文本显示为左侧。如果将重力设置为左侧,则将其显示为右侧。在它成为真值之前,我该怎么做 <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <TextView android:layout_width="fill_
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/manage_account_id_textview"
android:text="فارسي"
android:gravity="right"
/>
</LinearLayout>
你喜欢这样吗
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/manage_account_id_textview"
android:text="فارسي"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
</LinearLayout>
尝试使用
manage_account_id_textview.setTextDirection(View.TEXT_DIRECTION_RTL);
或
manage_account_id_textview.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);