android xml 未能解析文件,android – 无法解析属性“src”中的drawable

我在使用drawable-mdpi文件夹中的xml文件尝试将各种图像加载到图像按钮时遇到问题.它适用于一个按钮,但不适用于另一个按钮.代码适用于第二个图像按钮但不是第一个,我得到错误,

” main.xml: Unable to resolve drawable

“C:…workspace\AndroidAlarm\res\drawable-mdpi\keyEntry.xml” in

attribute “src”.

我在第一个imageButton做了完全相同的事情,我为第二个做了.第二个按钮(工作一个)的xml文件如下所示:

android:drawable="@drawable/events_pressed" />

对于那些不起作用的,它看起来像:

android:drawable="@drawable/key_entry_pressed" />

两者之间的唯一区别是传入的图像.所有图像都在drawabl-mdpi文件夹中找到.我无法弄清楚为什么它适用于第二个图像按钮而不是第一个.两个按钮的xml代码如下所示:

android:orientation="horizontal"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_weight="1">

android:id="@+id/imagebutton1"

android:src="@drawable/keyEntry"

android:background = "@android:color/transparent"

android:layout_width = "wrap_content"

android:layout_height = "wrap_content"

android:scaleType = "fitXY"

android:layout_marginTop = "50px"

android:layout_marginLeft = "40px"

android:layout_marginRight = "20px"

android:layout_marginBottom = "50px"

android:layout_weight="1"/>

android:layout_marginTop="50px"

android:layout_width="wrap_content"

android:layout_marginRight="40px"

android:id="@+id/imagebutton2"

android:layout_weight="1"

android:src="@drawable/events"

android:layout_height="wrap_content"

android:background="@android:color/transparent"

android:layout_marginLeft="20px"

android:layout_marginBottom="50px"

android:scaleType="fitXY">

提前致谢!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值