Skip to content Skip to sidebar Skip to footer

How To Make Text Align In Android Listview From Right To Left?

please I want to make my listview's items start from right to left like this how can I do it?

Solution 1:

Add the below to the Layout

android:layoutDirection="rtl"

Solution 2:

For that you need to provide a custom textview for you adapter. Something like this should do the trick:

listview.setAdapter(newArrayAdapter(context,R.layout.textview,newString[]{"one","2","3"}));

Then in your textview.xml referenced by above adapter put a textview and set its android:gravity="right".

Solution 3:

You can use a custom list and edit items to any way that you want.

http://www.learn2crack.com/2013/10/android-custom-listview-images-text-example.html

Abow link is your answer but in list_single.xml you must right:

<?xml version="1.0" encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="wrap_content" ><!-- you can add same margin and other thing to improve view --><TextViewandroid:id="@+id/textView1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentRight="true"android:layout_alignParentTop="true" ></RelativeLayout>

If it was useful mark it accepted and if NOT tell as comment to get more information.

Post a Comment for "How To Make Text Align In Android Listview From Right To Left?"