android.content.res.Resources$NotFoundException: Resource is not a Drawable
16lz
2021-01-25
这篇文章主要是对这个错误进行一个记录!
- 首先是这个错误的发生场景:
在Android的Project里面的res文件夹下有个专门放置xml资源的的drawable文件夹,这个文件夹不止一个,还有drawable-v24文件夹,做底部导航栏时,如果引用的drawable中的xml文件是位于drawable-v24文件夹下,就会出现这样的错误!所说的引用的xml文件就是此属性引用的xml文件:
app:DrawableTop="@drawable/main_tab_recommend_selector"
- 这里是代码:
<?xml version="1.0" encoding="utf-8"?>"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" android:orientation="vertical" tools:context="com.weibo.meishijie.mvp.view.activity.MainActivity"> "@+id/fragment" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> "@+id/bottom_navbar" android:layout_width="match_parent" android:layout_height="40dp" android:orientation="horizontal"> <com.weibo.meishijie.mvp.view.widget.Nav_RadioButton android:id="@+id/rb_recommend" style="@style/bottom_bar_radiobutton_style" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:checked="true" android:text="推荐" app:DrawableSize="30dp" app:DrawableTop="@drawable/main_tab_recommend_selector" /> <com.weibo.meishijie.mvp.view.widget.Nav_RadioButton android:id="@+id/rb_discovery" style="@style/bottom_bar_radiobutton_style" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:text="发现" app:DrawableSize="30dp" app:DrawableTop="@drawable/main_tab_discover_selector" /> <com.weibo.meishijie.mvp.view.widget.Nav_RadioButton android:id="@+id/rb_store" style="@style/bottom_bar_radiobutton_style" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:text="商城" app:DrawableSize="30dp" app:DrawableTop="@drawable/main_tab_store_selector" /> <com.weibo.meishijie.mvp.view.widget.Nav_RadioButton android:id="@+id/rb_topic" style="@style/bottom_bar_radiobutton_style" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:text="食话" app:DrawableSize="30dp" app:DrawableTop="@drawable/main_tab_topic_selector" /> <com.weibo.meishijie.mvp.view.widget.Nav_RadioButton android:id="@+id/rb_mine" style="@style/bottom_bar_radiobutton_style" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:text="我的" app:DrawableSize="30dp" app:DrawableTop="@drawable/main_tab_mine_selector" />
更多相关文章
- 一款常用的 Squid 日志分析工具
- GitHub 标星 8K+!一款开源替代 ls 的工具你值得拥有!
- RHEL 6 下 DHCP+TFTP+FTP+PXE+Kickstart 实现无人值守安装
- Linux 环境下实战 Rsync 备份工具及配置 rsync+inotify 实时同步
- Android关于arm64-v8a、armeabi-v7a、armeabi、X86的so文件兼容
- Android编程点滴(14) -- Android中资源文件夹res/raw和assets的
- Android(安卓)开发手记三
- android解析XML文件的三方法之Pull(读写)
- 如何修改原有的Android应用和添加应用