android.content.res.Resources$NotFoundException: Resource is not a Drawable
来源:互联网 发布:软件测试工程师的出路 编辑:程序博客网 时间:2024/05/16 16:05
这篇文章主要是对这个错误进行一个记录!
- 首先是这个错误的发生场景:
在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"?><LinearLayout 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" android:orientation="vertical" tools:context="com.weibo.meishijie.mvp.view.activity.MainActivity"> <FrameLayout android:id="@+id/fragment" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"></FrameLayout> <RadioGroup android:id="@+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" /> </RadioGroup></LinearLayout>
阅读全文