在BottomNavigationView下添加导航栏icon后出错,程序停止
我是跟着视频教程做的
最开始android:icon="@drawable/bookshelf"
视频是android:icon="@mipmap/bookshelf"
我以为是文件位置出错
将drawable下图标资源移动到mipmap
再修改代码为android:icon="@mipmap/bookshelf"
搜索他人的解决问题方法,大意是drawable下也要放资源文件
于是又复制一份图标资源移动到drawable下
还是没解决问题
后来又参考【Android】ImageView设置背景图片报错:Error inflating class ImageView
发现问题:添加图片资源到drawable是默认在drawable-v24目录下
解决方法:重新复制一份资源文件到drawable
修改代码为android:icon="@drawable/bookshelf"