Android 数字文本中的方向问题英语到阿拉伯语
我正在开发支持阿拉伯语和英语的android应用程序 对于阿拉伯语,我遵循以下步骤:Android 数字文本中的方向问题英语到阿拉伯语,android,android-layout,arabic-support,Android,Android Layout,Arabic Support,我正在开发支持阿拉伯语和英语的android应用程序 对于阿拉伯语,我遵循以下步骤: Android Studio>重构>尽可能添加RTL支持 第二,我将把这一行粘贴到manifest.xml:android:supportsRtl=“true” 或 我用开始和结束更改了布局属性左和右 哇,我很高兴看到这些变化,因为当我选择阿拉伯语时,一些设计将LTR,但当我测试我的应用程序时,我发现了一些问题 例如,请参见下图: 当我设置RTL时 您可以看到生日(1994年5月15日)显示为LTR
- Android Studio>重构>尽可能添加RTL支持
- 第二,我将把这一行粘贴到
:manifest.xml
android:supportsRtl=“true”
- 我用
和开始
更改了布局属性结束
和左
右
哇,我很高兴看到这些变化,因为当我选择阿拉伯语时,一些设计将
LTR
,但当我测试我的应用程序时,我发现了一些问题
例如,请参见下图:
当我设置RTL时
您可以看到生日(1994年5月15日)显示为LTR
,所有文本显示为RTL
(出生日期、性别、城市)
这里有一个问题,生日显示为“LTR”,那么为什么其他编辑文本不会显示为“RTL”
在这里您可以看到我的代码:
<RelativeLayout
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/_15sdp"
android:layout_marginStart="@dimen/_15sdp"
android:layout_marginTop="@dimen/_12sdp"
android:layout_width="match_parent">
<TextView
android:id="@+id/tv_age"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_5sdp"
android:layout_width="wrap_content"
android:text="@string/dob"
android:textColor="@color/color_gray"
android:textSize="@dimen/normal_input_text_size" />
<EditText
android:background="@null"
android:focusable="false"
android:gravity="end"
android:id="@+id/edit_dob"
android:layout_alignParentEnd="true"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_10sdp"
android:layout_toEndOf="@+id/tv_age"
android:layout_width="wrap_content"
android:singleLine="true"
android:text="15/05/1994"
android:textSize="@dimen/normal_input_text_size" />
</RelativeLayout><include layout="@layout/half_view" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_12sdp"
android:layout_marginStart="@dimen/_15sdp"
android:layout_marginEnd="@dimen/_15sdp"
android:gravity="center_vertical">
<TextView
android:id="@+id/tv_gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/gender"
android:layout_centerVertical="true"
android:textSize="@dimen/normal_input_text_size"
android:textColor="@color/color_gray"
android:layout_marginStart="@dimen/_5sdp" />
<EditText
android:id="@+id/edit_gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@+id/tv_gender"
android:layout_marginStart="@dimen/_10sdp"
android:layout_alignParentEnd="true"
android:gravity="end"
android:text="Male"
android:focusable="false"
android:textSize="@dimen/normal_input_text_size"
android:background="@null"
android:singleLine="true" />
</RelativeLayout><include layout="@layout/half_view" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_12sdp"
android:layout_marginStart="@dimen/_15sdp"
android:layout_marginEnd="@dimen/_15sdp"
android:gravity="center_vertical">
<TextView
android:id="@+id/tv_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/city"
android:layout_centerVertical="true"
android:textSize="@dimen/normal_input_text_size"
android:textColor="@color/color_gray"
android:layout_marginStart="@dimen/_5sdp" />
<EditText
android:id="@+id/edit_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@+id/tv_city"
android:layout_marginStart="@dimen/_10sdp"
android:layout_alignParentEnd="true"
android:gravity="end"
android:focusable="false"
android:text="Patan"
android:textSize="@dimen/normal_input_text_size"
android:background="@null"
android:singleLine="true" />
</RelativeLayout>
- 我已经读了这一页,但对我没有帮助
- 试试这个
在RTL中,当您将文本设置为数字时,就会发生这种情况
从API 19添加的LayoutDirection属性请检查
将以下属性添加到Edittext
android:layoutDirection="ltr"
RTL屏幕截图
LTR屏幕截图
有关更多信息,请检查此问题,这是相对布局问题。尝试线性布局。我也尝试了
LinearLayout
@dharajani为什么还有英语,你没有设置阿拉伯字符串吗?是的,听到没有设置阿拉伯语言我只是移动ENG
然后LTR
和arabic
然后RTL
@varadmondkar从edittexti删除重力我已经跟随了这个链接,我使用了你给定的行代码,但没有work@MohammadAli我刚登记了等一下你能检查一下吗您的minSdkVersion
@MohammadAli i已签入并发布screenshot@MohammadAli因为它的文本只是将文本设置为数字,然后重试