title: Centering items in ListView (Android)
body: <p>i have made a simple ListView, its working perfectly, the only thing i still nedd is to display the items in the centre of my ListView.</p>
  
  <p>this is my explication.xml code :</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@drawable/background"
  android:orientation="vertical" &gt;
  &lt;TextView
      android:id="@+id/textView1"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:gravity="center"
      android:text="Results"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:textColor="#e33939"
      android:textSize="40dp" /&gt;
  
  &lt;ListView
      android:id="@+id/list"
      android:layout_width="180dp"
      android:layout_height="430dp"
      android:layout_alignParentLeft="true"
      android:layout_alignParentRight="true"
      android:layout_below="@+id/textView1"
      android:gravity="center"
      android:background="#e33939" &gt;
  &lt;/ListView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>this is my activity Learn.java:</p>
  
  <pre><code>public class Learn extends  Activity {
  ListView listView ;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.explication);
  
      // Get ListView object from xml
      listView = (ListView) findViewById(R.id.list);
  
      // Defined Array values to show in ListView
      String[] values = new String[] { 
          " a = أ - ى - ا ", " b = ب ", " c = س ", " d = د ", " f = ف ", " h = ه " , " i = ئ", " j = ج",
          " k = ك", " l = ل", " m = م ", " n = ن", " o = ؤ ", " p = ب", " q = ك", " r = ر",  " s = س",
          " t = ت - ث - ة ", " v = ف " , " w = و" , " x = اكس" , " y = ي", " z = ز ", " sh = ش" , 
          " ء - ؤ = 2  " ,  " ع = 3  ", " غ = 3′ " , " ذ = 4 ", " خ = 5 ", " ط = 6  ", " ظ = ‘6 ",
          " ح = 7 ", " ق = 8  ", "ص =  9 " , " ض = ‘9  "
  
                                      };
  
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,
        android.R.layout.simple_list_item_1, android.R.id.text1, values);
  
      // Assign adapter to ListView
      listView.setAdapter(adapter); 
  
      // ListView Item Click Listener
      listView.setOnItemClickListener(new OnItemClickListener() {
  
            @Override
            public void onItemClick(AdapterView&lt;?&gt; parent, View view,
               int position, long id) {
  
             // ListView Clicked item index
             int itemPosition     = position;
  
             // ListView Clicked item value
             String  itemValue    = (String) listView.getItemAtPosition(position);
  
              // Show Alert 
              Toast.makeText(getApplicationContext(),""+"" +itemValue , Toast.LENGTH_LONG)
                .show();
            }
       }); 
  }
  }
  </code></pre>
  
  <p>the items are displayed in the left of the sceean. i have tried multiple things but no results. thank you</p>