Android Studio中的菜单模板显示不正确
我写了一个程序,在创建菜单时遇到了一个问题。我甚至拿了菜单模板,但意思还是一样。下面是一个在Android Studio中不适用于我的模板示例!嗯,我的代码是这样的。Android Studio中的菜单模板显示不正确,android,xml,android-studio,menu,drawer,Android,Xml,Android Studio,Menu,Drawer,我写了一个程序,在创建菜单时遇到了一个问题。我甚至拿了菜单模板,但意思还是一样。下面是一个在Android Studio中不适用于我的模板示例!嗯,我的代码是这样的。 . . 由于这些线,我们得到了前面的结果。 这个问题怎么解决呢?非常感谢。如果有任何错误,请检查logcat,并为其共享图像。如果有任何错误,根据我的理解,您指的是导航抽屉。您需要检查您的布局和活动代码,了解如何展示抽屉。你一定在这里读过导航抽屉的设计谢谢,我看过logcat。有很多错误。但最有趣的是,我启动了模拟器,它
.
.
由于这些线,我们得到了前面的结果。
这个问题怎么解决呢?非常感谢。如果有任何错误,请检查logcat,并为其共享图像。如果有任何错误,根据我的理解,您指的是导航抽屉。您需要检查您的布局和活动代码,了解如何展示抽屉。你一定在这里读过导航抽屉的设计谢谢,我看过logcat。有很多错误。但最有趣的是,我启动了模拟器,它可以正常工作,并且也可以显示,但在开发/编辑时,您看到了问题请检查logcat是否有任何错误,如果有任何错误,请共享图像根据我的理解,您指的是导航抽屉。您需要检查您的布局和活动代码,了解如何展示抽屉。你一定在这里读过导航抽屉的设计谢谢,我看过logcat。有很多错误。但最有趣的是,我启动了emulator,它的所有功能都很好,也可以显示出来,但在开发/编辑时,您看到了问题
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view"
<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/nav_home"
android:icon="@drawable/ic_menu_camera"
android:title="@string/menu_home" />
<item
android:id="@+id/nav_gallery"
android:icon="@drawable/ic_menu_gallery"
android:title="@string/menu_gallery" />
<item
android:id="@+id/nav_slideshow"
android:icon="@drawable/ic_menu_slideshow"
android:title="@string/menu_slideshow" />
<item
android:id="@+id/nav_tools"
android:icon="@drawable/ic_menu_manage"
android:title="@string/menu_tools" />
</group>
<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/ic_menu_share"
android:title="@string/menu_share" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/ic_menu_send"
android:title="@string/menu_send" />
</menu>
</item>
</menu>
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "file.example.test"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment:2.1.0'
implementation 'androidx.navigation:navigation-ui:2.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}