Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android:layout_height="?attr/actionBarSize" is not working with support:design:23.0.0' library

If I set android:layout_height="56dp", I can see the toolbar in graphical layout. But when I set like the 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 is not showing in graphical layout.

Studio says that attr/actionBarSize is marked as private.

I am using

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

What could be the issue? How can i fix it! Yes, Studio is updated.

like image 637
Rethinavel Avatar asked Sep 02 '15 11:09

Rethinavel


3 Answers

Use ?android:attr/actionBarSize instead of ?attr/actionBarSize

like image 77
Abhishek Dubey Avatar answered Nov 08 '22 14:11

Abhishek Dubey



finally i did it just change your method

?attr/actionBarSize to ?android:attr/actionBarSize

like image 28
Najaf Ali Avatar answered Nov 08 '22 16:11

Najaf Ali


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

The issue should be fixed in Android Studio 1.4 Preview 3. An update of the gradle plugin is also recommended. At least Gradle plugin version 1.4-alpha2

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

android {
    lintOptions {
        disable 'PrivateResource'
    }
}
like image 38
Christopher Avatar answered Nov 08 '22 14:11

Christopher