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

前端 未结 5 2188
后悔当初
后悔当初 2020-12-15 18:10

If I set android:layout_height=\"56dp\", I can see the toolbar in graphical layout. But when I set like the below,

       

        
相关标签:
5条回答
  • 2020-12-15 18:52

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

    0 讨论(0)
  • 2020-12-15 19:00

    finally i did it just change your method

    ?attr/actionBarSize to ?android:attr/actionBarSize

    0 讨论(0)
  • 2020-12-15 19:00

    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'
        }
    }
    
    0 讨论(0)
  • 2020-12-15 19:00

    What is your app theme ?

    Can you try to put android:theme="@style/Theme.AppCompat.Light" in your Toolbar layout ?

    0 讨论(0)
  • 2020-12-15 19:09

    It was a problem in setting the theme.

    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 selected the correct theme like here, it works fine for me!

    Hope it helps.

    0 讨论(0)
提交回复
热议问题