20
首先抱歉我的英語語言弱!如何設計從右到左的線性佈局
我設計了一個佈局。這是佈局的一部分:
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dip" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_details"
android:orientation="vertical"
android:padding="10dip" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right" >
<TextView
android:id="@+id/txt_details_ostan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#0000FF" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="استان"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#AA0000" />
</LinearLayout>
首選語言的方向是從右到左。紅色是主題,藍色是從數據庫中讀取的文本。
問題是,文本中有很多字符,並且在此佈局中顯示時,由於我的佈局是「從左到右」並且文本會填充所有佈局,因此該主題將消失。
我搜索了很多,但我找不到任何方法來改變佈局「從右到左」。
沒關係!非常感謝你 – Sadegh
android:layoutDirection =「rtl」這是一個更好的解決方案,如下所示:https://developer.android.com/reference/android/view/View.html#attr_android:layoutDirection – coder