android.content.res.Resources$NotFoundException: Resource is not a Drawable

这篇文章主要是对这个错误进行一个记录!

  • 首先是这个错误的发生场景:
    在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>

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值