How to center contents of ListFragment
<p>I have a simple layout :</p>

<pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center_vertical|center_horizontal"
    android:orientation="horizontal" &gt;
   &lt;fragment class="my.test.package.CitiesFragment"
      android:id="@+id/cities" android:layout_weight="4" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"      
      android:layout_gravity="center_vertical|center_horizontal"
      /&gt;
  //....
   &lt;/LinearLayout&gt;
</code></pre>

<p>to the left you can see i have a listfragment that i populate it with cities.
Listfragment consists of simple custom adapter:</p>

<pre><code>setListAdapter(new CitiesArrayAdapter&lt;String&gt;(getActivity(), R.layout.city_list_item, citiesArrayList));
</code></pre>

<p>and the city_list_item.xml is:</p>

<pre><code>&lt;my.test.package.VerticalTextView xmlns:android="http://schemas.android.com/apk/res/android"
        style="@style/verticalTextStyle"
        android:id="@+id/VerticalTextView" android:layout_width="fill_parent"
    android:layout_height="fill_parent"         
    android:gravity="center_horizontal|center_vertical"
    android:layout_gravity="center_horizontal|center_vertical"          
    android:background="@android:color/black"
    android:textColor="@android:color/white"
        /&gt;
</code></pre>

<p>VerticalTextView class was taken from this website. the code is here:
<a href="http://stackoverflow.com/questions/11435170/android-vertical-textview-with-image-next-to-it/11493549#1149354">VerticalTextView class</a></p>

<p>This is what i have so far:
<img src="http://i.stack.imgur.com/fdnIs.jpg" alt="enter image description here"></p>

<p>As you can see from pic the cities are left aligned. How can I center those cities ??? this is driving me nuts!</p>

<p><em><strong></em>* FOUND THE PROBLEM: its in the verticaltextview class:
    canvas.translate( getCompoundPaddingLeft(), getExtendedPaddingTop() );</strong></p>

<p>getCompoundPaddingLeft right top bottom always return 30 , and the layout gets messed up.
Anybody knows why?????????? or how to fix??</p>
