Android: layout_height = "? Attr / actionBarSize" does not work with support: design: 23.0.0 'library

If I set android:layout_height="56dp" , I see the toolbar in the graphic layout. But when I install as below,

  <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@color/purple" android:gravity="center_vertical" android:minHeight="?attr/actionBarSize" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> </android.support.v7.widget.Toolbar> 
Toolbar

not displayed in graphic layout.

The studio says attr/actionBarSize marked as private.

I use

  compile 'com.android.support:appcompat-v7:23.0.0' compile 'com.android.support:design:23.0.0' 

What could be the problem? How can I fix this! Yes, Studio has been updated.

+6
source share
3 answers

This is a problem with theme customization.

 Theme Values-v21. <style name="AppTheme" parent="Theme.AppCompat"> <item name="android:colorPrimary">@color/purple_medium</item> <item name="android:colorPrimaryDark">@color/purple</item> <item name="android:colorAccent">@color/iron</item> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="android:textColorHint">@color/black_lite</item> <item name="android:textColor">@color/black</item> <item name="android:textColorSecondary">@color/white</item> <item name="colorControlActivated">@color/purple</item> <item name="colorControlHighlight">@color/purple</item> <item name="colorControlNormal">@color/iron</item> <item name="android:textColorPrimary">@color/purple</item> <item name="android:windowContentTransitions">true</item> </style> 

when I chose the right theme, like here, it works great for me!

enter image description here

Hope this helps.

+1
source

This seems to be a bug in Android Studio: https://code.google.com/p/android/issues/detail?id=183120

The problem should be fixed in Android Studio 1.4 Preview 3. An update to the gradle plugin is recommended. No less gradle plugin version 1.4-alpha2

As a workaround, you can disable Lint-check in the build.gradle file:

 android { lintOptions { disable 'PrivateResource' } } 
+2
source

What is your theme for the app?

Can you put android:theme="@style/Theme.AppCompat.Light" in the toolbar layout?

0
source

All Articles