Caused by: android.view.InflateException: Binary XML file line #19: Binary XML file line #19: Error inflating class android.support.design.widget.BottomNavigationView
Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class android.support.design.widget.BottomNavigationView
Gradle源码
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha01'
implementation 'androidx.cardview:cardview:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
布局XML源代码
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="parent"
app:menu="@menu/menu_bottomnavigationview">
</android.support.design.widget.BottomNavigationView>
我错过了什么吗?
Android Studio是否仍支持 android.support.design.widget.BottomNavigationView
?
@menu/menu_bottomnavigationview
菜单。要检查它,你可以尝试删除app:menu="@menu/menu_bottomnavigationview"
(如果可以)。然后重新运行应用程序。 - John Le