简体   繁体   English

支持设计v.23.1.0和v.23.1.1打破了NavigationView中的菜单

[英]Support design v.23.1.0 and v.23.1.1 broke menu in NavigationView


New versions of Support design (23.1.0 and 23.1.1) broke menu in NavigationView 支持设计的新版本(23.1.0和23.1.1)打破了NavigationView中的菜单
Normal menu 普通菜单
在此处输入图片说明

Menu in new api version 新API版本中的菜单
在此处输入图片说明

Menu xml 菜单XML

<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="none">
    <item
        android:id="@+id/navigation_item_1"
        android:icon="@drawable/ic_logout"
        android:title="@string/navigation_list_log_out" />

    <item
        android:id="@+id/navigation_item_2"
        android:icon="@drawable/ic_logout"
        android:title="@string/navigation_list_log_out" />

    <item
        android:id="@+id/navigation_item_3"
        android:icon="@drawable/ic_logout"
        android:title="@string/navigation_list_log_out" />
</group>

So last right version is 所以最后一个正确的版本是

compileSdkVersion 23
buildToolsVersion "23.0.1"
compile 'com.android.support:design:23.0.1'

Maybe Google know how to fast fix this bug in new version? 也许Google知道如何快速修复此错误的新版本?

Unfortunately, it looks like version 23.1.0 - 23.1.1 of the support library broke the behaviour of the android:checkableBehaviour attribute, as well as the menuItem.setChecked(boolean) method. 不幸的是,支持库的版本23.1.0-23.1.1似乎破坏了android:checkableBehaviour属性以及menuItem.setChecked(boolean)方法的行为。

You may want to keep an eye on this AOSP Issue , which details the reason why these behaviours are broken. 您可能需要关注此AOSP问题 ,该问题详细说明了这些行为被破坏的原因。

Try calling something like mNavView.setItemTextColor(mNavView.getItemTextColor) as a workaround, as recommended in that issue. 按照该问题的建议,尝试调用mNavView.setItemTextColor(mNavView.getItemTextColor)类的解决方法。

Please change none to single. 请不更改为单个。

<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
    <item
        android:id="@+id/navigation_item_1"
        android:icon="@drawable/ic_logout"
        android:title="@string/navigation_list_log_out" />

    <item
        android:id="@+id/navigation_item_2"
        android:icon="@drawable/ic_logout"
        android:title="@string/navigation_list_log_out" />

    <item
        android:id="@+id/navigation_item_3"
        android:icon="@drawable/ic_logout"
        android:title="@string/navigation_list_log_out" />
</group>
</menu>

Change 'com.android.support:design: 23.0.1 ' to 'com.android.support:design: 23.1.1 'then sync the project. 更改'com.android.support:design:23.0.1''com.android.support:design:23.1.1'然后同步的项目。 The version actually works. 该版本实际上有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android支持v23.1.0更新中断NavigationView get / find标头 - Android support v23.1.0 update breaks NavigationView get/find header Android设计库23.1.0 NavigationView - Android Design Library 23.1.0 NavigationView 将v7 appcompat支持库升级到v23.1.0 - upgrading the v7 appcompat support library to v23.1.0 使用支持库设计v 23.1.1时,属性“ borderWidth”已定义为错误 - Attribute “borderWidth” already defined error while using Support Library Design v 23.1.1 找不到 com.android.support:appcompat-v7:23.1.1 - Could not find com.android.support:appcompat-v7:23.1.1 错误:无法解决:android.support:compatibility-v4:23.1.1 - Error:Failed to resolve: android.support:compatibility-v4:23.1.1 升级到android支持库v23.1.0时退出值2 - Exit value 2 when upgrading to android support library v23.1.0 actionButtonStyle不适用于支持lib v23.1.0 - actionButtonStyle doesn't work with support lib v23.1.0 无法解析com.android.support.recylerview-v7:23.1.0 - failed to resolve com.android.support.recylerview-v7:23.1.0 警告:模块版本com.android.support:appcompat-v7:23.1.0取决于库,但为jar - Warning:Module version com.android.support:appcompat-v7:23.1.0 depends on libraries but is a jar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM