Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set RTL in TextInputLayout?

Tags:

android

I search solution for me, but didn't find somethings for me.

This is my style, TextInputLayout:

<style name="MyWidget.TextInputLayout.StyleName" parent="TextAppearance.AppCompat">
    <item name="colorAccent">@color/yellow_my_mission_item_icon</item>
    <item name="android:textColorHint">@color/text_input_layout_hint_inactive</item>
    <item name="colorControlNormal">@color/black</item>
    <item name="colorControlActivated">@color/text_input_layout_active</item>
    <item name="colorControlHighlight">@color/green</item>
    <item name="android:gravity">start</item>
    <item name="android:layoutDirection">rtl</item>
    <item name="android:textAlignment">viewStart</item>
</style>

And for EditText:

<style name="MyWidget.EditText.StyleName">
    <item name="android:textColor">@color/black</item>
    <item name="android:textSize">17sp</item>
    <item name="android:textAlignment">viewStart</item>
    <item name="android:gravity">start</item>
</style>

But on the screen it's seen like: enter image description here

like image 249
Artem Avatar asked Dec 18 '22 11:12

Artem


1 Answers

According to the Google link that Mavya Soni shared, if you modify strings.xml with arabic text it will show correctly in RTL:

<string name="first_name">"الاسم الخاص"</string>
<string name="last_name">"اسم العائلة"</string>
like image 155
Veener Avatar answered Dec 25 '22 05:12

Veener