When you create a list and fill it with words, they are automatically aligned to the left. Is it possible to do a center alignment?

Description listview:

<ListView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/version" android:layout_centerHorizontal="true" android:id="@+id/about_list" /> 

Filling it with data:

 listView = (ListView)findViewById(R.id.about_list); ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.element_of_about, getResources().getStringArray(R.array.about_choose)); listView.setAdapter(adapter); 

Type of custom markup textview (element_of_about):

 <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_gravity="center_horizontal" android:gravity="center" android:text="Пробный текст" style="@style/text_of_breed" android:padding="10dp" android:textSize="17sp"/> 

With these settings, the text is still on the left.

enter image description here

    1 answer 1

    In the TextView markup, change android:layout_width="wrap_content" to android:layout_width="match_parent"