Android 4.2 Material TextInputLayout 提示在 rtl 模式下不显示
Android 4.2 Material TextInputLayout hint not showing in rtl mode
Material TextInputLayout 中的浮动提示在切换 rtl 模式时不显示,
当 locale 是 ltr 时一切正常:
LTR MODE, FLOATING HINT IS WORKING
但在 rtl 中它消失了:
RTL MODE AND NO HINT
这是我的一部分 XML:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/code_text_input"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginBottom="8dp"
app:hintEnabled="true"
app:layout_constraintTop_toTopOf="@+id/login">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/code_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/activate_code"
android:inputType="number"
android:textSize="@dimen/large_text" />
</com.google.android.material.textfield.TextInputLayout>
我得到了一些东西。
问题出在波斯语或阿拉伯语字符串上。但当字符串为拉丁文时,即使在 RTL 模式下也能正常工作。
我之前遇到过这种情况,比如应用rtl显示阿拉伯文字
我用过这个xml:
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:hintAnimationEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/phoneEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone"
android:hint="@string/phone_number_label" />
</com.google.android.material.textfield.TextInputLayout>
请注意,如果您想显示阿拉伯语文本,您应该为阿拉伯语区域设置 strings.xml 文件。
终于修好了。
我使用了 material design
的最新库
com.google.android.material:material:1.2.0-alpha02
我改成了
com.google.android.material:material:1.1.0-alpha05
一切都很好。
Material TextInputLayout 中的浮动提示在切换 rtl 模式时不显示, 当 locale 是 ltr 时一切正常: LTR MODE, FLOATING HINT IS WORKING
但在 rtl 中它消失了: RTL MODE AND NO HINT
这是我的一部分 XML:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/code_text_input"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginBottom="8dp"
app:hintEnabled="true"
app:layout_constraintTop_toTopOf="@+id/login">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/code_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/activate_code"
android:inputType="number"
android:textSize="@dimen/large_text" />
</com.google.android.material.textfield.TextInputLayout>
我得到了一些东西。 问题出在波斯语或阿拉伯语字符串上。但当字符串为拉丁文时,即使在 RTL 模式下也能正常工作。
我之前遇到过这种情况,比如应用rtl显示阿拉伯文字
我用过这个xml:
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:hintAnimationEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/phoneEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone"
android:hint="@string/phone_number_label" />
</com.google.android.material.textfield.TextInputLayout>
请注意,如果您想显示阿拉伯语文本,您应该为阿拉伯语区域设置 strings.xml 文件。
终于修好了。 我使用了 material design
的最新库com.google.android.material:material:1.2.0-alpha02
我改成了
com.google.android.material:material:1.1.0-alpha05
一切都很好。