title: ListFragment with Custom Adapter
body: <p>I have setup a <code>listfragment</code> in my project. but it seems my fragment cant get it right with my adapter. its because of <code>Context context</code> in <code>MyListAdapter</code>. if i click to correct it. it changes into <code>MenuFragment menuFragment</code>. But after that changes, <code>MyListAdapter</code> got error. so i correct it. it changes into <code>Context context</code>. and again if i correct it, its still goes on and on. its looping like that. </p>
  
  <p>Note: What i want to achieve is ListFragment with icon. like my other question before (but unfortunately no one answer it).</p>
  
  <pre><code>public class MenuFragment extends ListFragment {
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      return super.onCreateView(inflater, container, savedInstanceState);  
      }
  
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
  
       String [] proMenu ={ "Homies", "Best Nearby", "Coupon" , "Profile" , "History" , "", "Setting" ,
                 "About" , "Sign Out"};
  
       setListAdapter(new MyListAdapter(this, proMenu));
  
  }
  
  @Override
  public void onListItemClick(ListView lv, View v, int position, long id) {
      Fragment newContent = null;
      switch (position) {
      case 0:
          newContent = new ColorFragment();
          break;
      case 1:
          Intent intent7 = new Intent();
          intent7.setClass(getActivity(), Home.class);
          intent7.putExtra("index", position);
          startActivity(intent7);
          break;
  </code></pre>
  
  <p>EDIT : This is my layout. its perfectly fine now. i just have to tweak the textview and linear layout, so that the word not cut in half. but i'm facing another problem. its like the background image is piling up each other. this is the xml on my 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="match_parent"
  android:layout_height="50dp"
  android:orientation="horizontal" 
  android:cacheColorHint="#00000000" 
  android:background="@drawable/menu_drawer"&gt;  
  
  &lt;ImageView
      android:id="@+id/row_icon"
      android:layout_width="50dp"
      android:layout_height="50dp"
      android:padding="10dp"
      android:src="@drawable/ic_launcher" /&gt;
  
  &lt;TextView
      android:id="@+id/row_title"
      android:layout_width="0dp"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:gravity="center_vertical"
      android:padding="10dp"
      android:text="Medium Text"
      android:textSize="20dp"
      android:textAppearance="@android:style/TextAppearance.Medium" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/qcME7.jpg" alt="the layout"></p>
  
  <p>And if i remove this <code>android:background="@drawable/menu_drawer"</code> from the <code>linear layout</code>. it will be the perfect background. not piling up each other. but when i'm swiping in the list, the background go nuts, its gone and showing some black background in it. its like the problem with listview <code>android:cacheColorHint="#00000000"</code>. i already added that <code>cachecolor</code> in <code>linear layout</code>. but its still showing those black background. its like this. </p>
  
  <p><img src="https://i.stack.imgur.com/S5hM5.jpg" alt="this is what happen when i remove &lt;code&gt;android:background&lt;/code&gt;"></p>
  
  <p>i know whats the problem are. its because the default background are black. but i dont know how to solve it. </p>
  
  <p>EDIT2 : Black Problem Solved. </p>
  
  <p>SOLVED.</p>