Domanda

I'm using Autocompletetextview with google place service. I'm trying to change the text direction from it's default (ltr) to rtl since the language issue.

This is how it looks by now : enter image description here

I've searched about this issue for a while and haven't found anything.

This is the xml code, following this tutorial:

<?xml version="1.0" encoding="utf-8"?>
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="35dp"
    android:textSize="15dp"
    android:gravity="right"
    />

When I tried to put this TextView inside a layout (Linear / Relative), the app crashed once I started to type inside.

È stato utile?

Soluzione

Got the answer, the xml should look like this:

   <?xml version="1.0" encoding="utf-8"?>
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="35dp"
     android:textSize="15dp"
     android:gravity="right"
     />

The differnce is

 android:layout_width="match_parent"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top