Error inflating class android.support.v7.widget.Toolbar -


i trying use toolbar (android.support.v7.widget.toolbar) navigation drawer. shows exception "error inflating class android.support.v7.widget.toolbar". code working fine if don't use android.support.v7.widget.toolbar in xml. activity extending android.support.v7.app.actionbaractivity. here main_activity.xml

    <!--          main content view, view below consumes entire          space available using match_parent in both dimensions.      -->      <framelayout         android:id="@+id/container"         android:layout_width="match_parent"         android:layout_height="match_parent" >           <linearlayout         android:layout_width="match_parent"         android:layout_height="match_parent"         android:orientation="vertical">          <!-- use toolbar our drawer can displayed              in front of action bar -->         <android.support.v7.widget.toolbar               android:id="@+id/my_awesome_toolbar"             android:layout_height="wrap_content"             android:layout_width="match_parent"             android:minheight="?attr/actionbarsize"             android:background="?attr/colorprimary" />       </linearlayout>          </framelayout>      <!--          android:layout_gravity="start" tells drawerlayout treat          sliding drawer on left side left-to-right          languages , on right side right-to-left languages.          if you're not building against api 17 or higher, use          android:layout_gravity="left" instead.     -->     <!--          drawer given fixed width in dp , extends full height of          container.     -->      <fragment         android:id="@+id/navigation_drawer"         class="com.jooleh.android.merchant.navigationdrawerfragment"         android:layout_width="300dp"         android:layout_height="match_parent"         android:layout_gravity="start"         tools:layout="@layout/fragment_navigation_drawer" />  </android.support.v4.widget.drawerlayout> 

styles.xml

 <style name="appbasetheme" parent="theme.appcompat">         <item name="colorprimary">@color/red_primary_500</item>         <item name="colorprimarydark">@color/red_primary_700</item>         <item name="coloraccent">@color/green_secondary</item>         <item name="windowactionbar">false</item>      </style> 

styles-v11

<style name="appbasetheme" parent="theme.appcompat">         <!-- api 11 theme customizations can go here. -->         <item name="windowactionbar">false</item>     </style> 

styles-v14

<style name="appbasetheme" parent="theme.appcompat">         <!-- api 14 theme customizations can go here. -->         <item name="windowactionbar">false</item>     </style> 

i testing on jellybean, minsdkversion="16" , targetsdkversion="21".

i able solve problem replacing following:

in toolbar layout, replace:

android:minheight="?attr/actionbarsize" android:background="?attr/colorprimary" 

with

android:minheight="@dimen/abc_action_bar_default_height_material" android:background="@color/mycolor" 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -