Почему меню не отображается должным образом? - PullRequest
0 голосов
/ 19 октября 2019

XML-код моего ящика_меню

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">

<group android:checkableBehavior="single">
    <item android:id="@+id/sun"
        android:title="Sun"/>
    <item android:id="@+id/moon"
        android:title="Moon"/>
    <item android:id="@+id/planets"
        android:title="Planets"/>
    <item android:id="@+id/stars"
        android:title="Stars"/>
</group>
<item android:title="Communicate">
    <menu>
        <item android:id="@+id/nav_sun"
            android:title="Sun"/>
    </menu>
</item>

Menu look like

Меню выглядит как Как это исправить?

Мои зависимости

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

Я думаю, что мне нужно что-то для моих зависимостей. Но в нете я не нашел ничего связанного с androidx

1 Ответ

0 голосов
/ 19 октября 2019

Причина: tools:showIn="navigation_view". удалить его из XML. Это ошибка андроид студии.

...