title: Styling the android listview with array list adapter
body: <p>I have written the code for creating a list out of some arrays shown below!
  code runs properly and output is as expected!</p>
  
  <p><strong>update for people with same prob:</strong> <a href="http://www.framentos.com/en/android-tutorial/2012/07/16/listview-in-android-using-custom-listadapter-and-viewcache/" rel="nofollow">nice tutorial for custom listview</a> </p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>public class MainActivity extends Activity {
  
   @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
     ListView listView1 = (ListView) findViewById(R.id.listView1);
  
      String[] items = { "some", "fancy", "items", "to", "show" };
  
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,
                  R.layout.listitem, items);
  
      listView1.setAdapter(adapter);
     }
  </code></pre>
  
  <p><strong>activity_main.xml</strong></p>
  
  <pre><code>   &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
     tools:context=".MainActivity" &gt;
  
    &lt;ListView 
      android:id="@+id/listView1" 
      android:layout_height="fill_parent"
      android:layout_width="fill_parent" /&gt;
  
     &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>listview.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content" 
  android:textSize="20sp"
  android:padding="22dp"
  android:gravity="center_horizontal"
  /&gt;
  </code></pre>
  
  <p><strong>what I want to accomplish?</strong></p>
  
  <ol>
  <li><p>change color and font of the text in each list item to a different one..and do some task on tapping on them...</p></li>
  <li><p>also is it possible to get another listview inside the same listview
  eg. if I click on a list item it again shows me a list (kind of a sub list) with different list items on that same activity(or screen).and some action could be done on tapping the sub list items.</p></li>
  </ol>
  
  <p><strong>Detailed answers are appreciated as I am new to android development..
  Thanks!</strong></p>