title: android.support.v7.widget.AppCompatTextView cannot be cast to android.widget.ImageView
body: <p>Here is the activity_main.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout 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:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context="com.issaayoub.materialtest.MainActivity"&gt;
  
      &lt;include
          android:id="@+id/app_bar"
          layout="@layout/app_bar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" /&gt;
  
      &lt;android.support.v4.widget.DrawerLayout
          android:id="@+id/drawer_layout"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;RelativeLayout
              android:id="@+id/activity_main"
              android:layout_width="match_parent"
              android:layout_height="match_parent"&gt;
  
              &lt;android.support.design.widget.TabLayout
                  android:id="@+id/tabLayout"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="@color/colorPrimary"
                  android:elevation="4dp"&gt;
  
                  &lt;android.support.design.widget.TabItem
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:icon="@drawable/an"
                      android:text="@string/bird1" /&gt;
  
              &lt;/android.support.design.widget.TabLayout&gt;
  
              &lt;android.support.v4.view.ViewPager
                  android:id="@+id/viewpager"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_below="@id/tabLayout"&gt;
  
              &lt;/android.support.v4.view.ViewPager&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;fragment
              android:id="@+id/fragment_navigation_drawer"
              android:name="com.issaayoub.materialtest.NavigationDrawerFragment"
              android:layout_width="@dimen/navigation_drawer_width"
              android:layout_height="match_parent"
              android:layout_gravity="start"
              app:layout="@layout/fragment_navigation_drawer"
              tools:layout="@layout/fragment_navigation_drawer" /&gt;
  
      &lt;/android.support.v4.widget.DrawerLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Whenever I added the current TabItem inside the TabLayout I got the following error: </p>
  
  <blockquote>
    <p>android.support.v7.widget.AppCompatTextView cannot be cast to
    android.widget.ImageView</p>
  </blockquote>
  
  <p>When opening the details of the rendering problem I got the follows:</p>
  
  <pre><code>java.lang.ClassCastException: android.support.v7.widget.AppCompatTextView cannot be cast to android.widget.ImageView
      at android.support.design.widget.TabLayout$TabView.update(TabLayout.java:1675)
      at android.support.design.widget.TabLayout$TabView.setTab(TabLayout.java:1627)
      at android.support.design.widget.TabLayout.createTabView(TabLayout.java:927)
      at android.support.design.widget.TabLayout.newTab(TabLayout.java:562)
      at android.support.design.widget.TabLayout.addTabFromItemView(TabLayout.java:481)
      at android.support.design.widget.TabLayout.addViewInternal(TabLayout.java:970)
      at android.support.design.widget.TabLayout.addView(TabLayout.java:960)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:862)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
      at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
      at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
      at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
      at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
      at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
      at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
      at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
      at com.android.tools.idea.rendering.RenderTask.lambda$inflate$53(RenderTask.java:659)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>Could someone please highlight out what is the problem with the TabItem. </p>
  
  <p><em>Removing the TabItem will remove all this error. Finally, please note that the application is running normally without any error on the phone/emulator.</em> </p>
  
  <p>Thanks for help!!</p>