萨拉姆.
在我的项目中,我必须为语言和语言创建两者layout-ldltr和layout-ldrtl布局.Right-To-LeftLeft-To-Right
我启动了从右到左语言的应用程序,每件事都很好.但是当方向改变时,android加载layout-ldltr布局反对layout-ldrtl,虽然当前Locale设置为RTL语言!
怎么解决这个问题?!
在 AndroidManifest.xml
android:name=".QuranApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
在layout-ldrtl\activity_main.xml:
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layoutDirection="rtl">
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layoutDirection="rtl">
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layoutDirection="rtl"/>
layout="@layout/list_view"
android:layout_width="@dimen/drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start" />
UPDATE
在@JohanShogun评论之后,我改变android:layoutDirection="rtl"了android:layoutDirection="locale"并解决了大多数项目的问题.
在第一张照片中,所有元素都显示非常好:
在横向模式下,在粘贴在屏幕顶部的标题项中的StickyListHeader列表视图中,从ltr布局使用android !: