title: Icons are not showing up in list view navigation drawer
body: <p>I am trying to implement a navigation drawer in a drawer layout. So far I have created the drawer and inflated the layouts but the problem is that in the <code>listview</code> of the navigation drawer the icons are not showing up along the titles. Apart form this the <code>listview</code> items are also showing up in the action overflow in action bar. </p>
  
  <p>I have also implemented <code>onClick</code> on all <code>listview</code> items. I have added the items along with icons programmatically but the problem still remains. These code snippets will help you get the clear picture of what I am doing.</p>
  
  <p><strong>main_activity:</strong></p>
  
  <pre><code>    private static String TAG=MainActivity.class.getSimpleName();
      ListView mDrawerList;
      RelativeLayout mDrawerPane;
      private ActionBarDrawerToggle mdrawerToggle;
      private DrawerLayout mDrawerLayout;
      ArrayList&lt;NavItem&gt; mNavItems=new ArrayList&lt;&gt;();
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          mNavItems.add(new NavItem("Feed", "Checkout new stories",R.drawable.feed));
          mNavItems.add(new NavItem("Source", "Authentic Sources", R.drawable.source));
          mNavItems.add(new NavItem("Bookmarks","Saved Stories",R.drawable.bookmark));
  
          mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
          mDrawerPane = (RelativeLayout) findViewById(R.id.drawerPane);
          mDrawerList = (ListView) findViewById(R.id.nav_list);
          DrawerListAdapter adapter= new DrawerListAdapter(this,mNavItems);
          mDrawerList.setAdapter(adapter);
          mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener(){
  
            @Override
            public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long id) {
                selectItemFromDrawer(position);
            }
  
            });
          mdrawerToggle=new ActionBarDrawerToggle(this,mDrawerLayout,R.string.navigation_drawer_open,R.string.navigation_drawer_close){
              @Override
              public void onDrawerOpened(View drawerView){
                  super.onDrawerOpened(drawerView);
                  invalidateOptionsMenu();
              }
              @Override
              public void onDrawerClosed(View drawerView){
                  super.onDrawerClosed(drawerView);
                  Log.d(TAG, "onDrawerClosed: " + getTitle());
                  invalidateOptionsMenu();
              }
          };
          mDrawerLayout.addDrawerListener(mdrawerToggle);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
        private void selectItemFromDrawer(int position){
            Fragment fragment=new preferenceFragment();
            FragmentManager fragmentManager = getSupportFragmentManager();
            fragmentManager.beginTransaction().replace(R.id.main_content,fragment).commit();
            mDrawerList.setItemChecked(position,true);
            setTitle(mNavItems.get(position).mtitle);
  
            mDrawerLayout.closeDrawer(mDrawerPane);
        }
  
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item)
      {
          if(mdrawerToggle.onOptionsItemSelected(item)){
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
      @Override
      protected void onPostCreate(Bundle savedInstanceState) {
          super.onPostCreate(savedInstanceState);
          mdrawerToggle.syncState();
      }
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
  
      }
  
      @Override
      public boolean onNavigationItemSelected(@NonNull MenuItem item) {
  
  
          return false;
      }
  
  
      class NavItem{
          String mtitle;
          String mSubtitle;
          int mIcon;
          public NavItem(String title, String subtitle, int icon){
  
              mtitle=title;
              mSubtitle=subtitle;
              mIcon=icon;
  
          }
  
      }
  }
  </code></pre>
  
  <p><strong>drawer list adapter:</strong></p>
  
  <pre><code>public class DrawerListAdapter extends BaseAdapter {
  
      Context mcontext;
      ArrayList&lt;MainActivity.NavItem&gt; mNavItems;
  
      public DrawerListAdapter(Context context, ArrayList&lt;MainActivity.NavItem&gt; navItems){
          mcontext=context;
          mNavItems=navItems;
      }
      @Override
      public int getCount() {
          return mNavItems.size();
      }
  
      @Override
      public Object getItem(int position  ) {
          return mNavItems.get(position);
      }
  
      @Override
      public long getItemId(int i) {
          return 0;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          View view;
  
          if(convertView==null){
  
              LayoutInflater inflater=(LayoutInflater)mcontext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              view=inflater.inflate(R.layout.drawer_item,null);
          }
          else{
              view=convertView;
          }
          TextView titleView=(TextView)view.findViewById(R.id.title);
          TextView subtitleView=(TextView) view.findViewById(R.id.subtitle);
          ImageView iconView=(ImageView) view.findViewById(R.id.icon);
  
          titleView.setText(mNavItems.get(position).mtitle);
          subtitleView.setText(mNavItems.get(position).mSubtitle);
          iconView.setImageResource(mNavItems.get(position).mIcon);
          return view;
      }
  }
  </code></pre>
  
  <p><strong>xml for main layout:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      tools:context="com.dpl_it.m.hamzam.reader.MainActivity"
      tools:openDrawer="start" &gt;
  &lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/main_content"/&gt;
      &lt;RelativeLayout
          android:layout_width="280dp"
          android:layout_height="match_parent"
          android:id="@+id/drawerPane"
          android:layout_gravity="start"&gt;
          &lt;RelativeLayout
              android:id="@+id/profileBox"
              android:layout_width="match_parent"
              android:layout_height="100dp"
              android:background="@color/colorPrimaryDark"
              android:padding="8dp" &gt;
          &lt;ImageView
              android:id="@+id/avatar"
              android:layout_width="50dp"
              android:layout_height="50dp"
              android:src="@mipmap/ic_launcher"
              android:layout_marginTop="15dp"/&gt;
  
          &lt;LinearLayout
              android:layout_width="wrap_content"
              android:layout_height="42dp"
              android:layout_centerVertical="true"
              android:orientation="vertical"
              android:layout_marginLeft="15dp"
              android:layout_toRightOf="@+id/avatar"&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:id="@+id/username"
                  android:text="Dabir"
                  android:textColor="#fff"
                  android:textSize="16sp"
                  android:textStyle="bold" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:id="@+id/description"
                  android:text="View Profile"
                  android:textColor="#fff"
                  android:textSize="12sp"
                  android:layout_gravity="bottom"
                  android:layout_marginTop="4dp"/&gt;
          &lt;/LinearLayout&gt;
      &lt;/RelativeLayout&gt;
          &lt;ListView
          android:layout_width="280dp"
          android:layout_height="match_parent"
          android:id="@+id/nav_list"
          android:layout_below="@+id/profileBox"
          android:choiceMode="singleChoice"
          android:background="#fff"&gt;
  
          &lt;/ListView&gt;
  
  &lt;/RelativeLayout&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p><strong>xml for drawer items:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingTop="10dp"
      android:paddingBottom="10dp"&gt;
  
      &lt;ImageView
          android:layout_width="40dp"
          android:layout_height="40dp"
          android:id="@+id/icon"
          android:src="@mipmap/ic_launcher"
         android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginLeft="10dp"
          android:layout_marginRight="20dp"
          android:layout_marginTop="5dp"/&gt;
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/title"
          android:textSize="18sp"
          android:gravity="center_vertical"
          android:textColor="@color/textcolor"
          android:text="line 1"
          android:textStyle="bold"
          android:layout_alignParentTop="true"
          android:layout_toRightOf="@+id/icon"
          android:layout_toEndOf="@+id/icon" /&gt;
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="line 2"
          android:id="@+id/subtitle"
          android:layout_toRightOf="@+id/icon"
          android:layout_below="@+id/title"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:textColor="@color/textcolor"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>