[英]Android Kitkat 4.4.2 ImageView setBackgroundResource not working?
Today i came through a strange problem that ImageView.setBackgroundResource() is not working in android kitkat 4.4.2, but it is working fine in other versions. 今天,我遇到了一个奇怪的问题,即ImageView.setBackgroundResource()在android kitkat 4.4.2中无法正常工作,但在其他版本中却可以正常工作。 This is how i am using it:
这就是我的使用方式:
imageView.setBackgroundResource(R.drawable.imageview_border);
This is the drawable: 这是可绘制的:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="6dip"
android:color="@color/brown" />
<padding
android:bottom="6dip"
android:left="6dip"
android:right="6dip"
android:top="6dip" />
</shape>
I have searched a lot but did not able to solve the problem. 我进行了很多搜索,但未能解决问题。 I don't know whether someone else is facing this problem in 4.4.2 except me or not.
我不知道除了我以外,是否有人在4.4.2中正面临这个问题。 Please help me.
请帮我。
Use this 用这个
imageView.setImageResource(R.drawable.imageview_border);
Instead of this 代替这个
imageView.setBackgroundResource(R.drawable.imageview_border);
It will work. 它会工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.