Я новичок в разработке android, и я проектировал навигационный ящик, и я использую java и android studio 3.6.2, но после написания следующего кода я не получаю навигационный ящик. Я хочу знать, что я что-то упустил в файле. xml или я не написал каких-либо важных зависимостей? Пожалуйста помоги!
Я написал следующий код. build.gradle (: app), а также я написал реализацию зависимостей 'com.google. android .material: material: 1.1.0'
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.navigationdrawer"
minSdkVersion 19
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 'com.google.android.material:material:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
In the .xml file i have included the
``
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view"
hook_menu. 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/nav_message"
android:icon="@drawable/ic_message"
android:title="Message" />
<item
android:id="@+id/nav_chat"
android:icon="@drawable/ic_chat"
android:title="Chat" />
<item
android:id="@+id/nav_profile"
android:icon="@drawable/ic_profile"
android:title="Profile" />
</group>
<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/ic_share"
android:title="Share" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/ic_send"
android:title="Share" />
</menu>
</item>
</menu>
Моя активность_основа. xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
У меня такой тип просмотра