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

Rethinavel picture Rethinavel · Sep 2, 2015 · Viewed 23.8k times · Source

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.

Answer

Abhishek Dubey picture Abhishek Dubey · Apr 7, 2018

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