当我放入XML及其属性时,它不会出现在设计部分,我不知道是否发生了什么,因为它实例化了所需的所有依赖项。
<com.google.android.material.bottomnavigation.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/nav_menu"> </com.google.android.material.bottomnavigation.BottomNavigationView>和依赖关系:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.2.0-beta01'
implementation 'com.google.android.material:material:1.2.0-beta01'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
}它们都是我使用的依赖项,向我展示设计的图像是这样的:enter image description here
我没有看到任何导航栏或任何错误,我不知道该怎么办,请帮帮忙。
发布于 2020-07-01 19:51:26
删除这2个依赖项
implementation 'com.google.android.material:material:1.2.0-beta01'
implementation 'com.google.android.material:material:1.2.0-beta01'并将它们替换为以下内容
implementation 'com.android.support:design:26.1.0'试着也使用这段代码
布局资源文件:
<com.google.android.material.bottomnavigation.BottomNavigationView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schema.android.com/apk/res/res-auto"
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="start"
app:menu="@menu/my_navigation_items" />res/menu/my_navigation_items.xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/action_search"
android:title="@string/menu_search"
android:icon="@drawable/ic_search" />
<item android:id="@+id/action_settings"
android:title="@string/menu_settings"
android:icon="@drawable/ic_add" />
<item android:id="@+id/action_navigation"
android:title="@string/menu_navigation"
android:icon="@drawable/ic_action_navigation_menu" />
</menu>https://stackoverflow.com/questions/62119032
复制相似问题