how to get the source of ImageView in order to change it?

后端 未结 7 1841
醉话见心
醉话见心 2020-12-15 06:23

I know that changing the ImageView resource is not big deal just using myImageView.setImageResource(mynewImageDrawable)

but what I want to do is to chec

相关标签:
7条回答
  • 2020-12-15 06:57

    Actualy after my try ,I find there is a way to get source of imageView without need of tag property.

    Integer src = attrs.getAttributeResourceValue(
                        "http://schemas.android.com/apk/res/android", "src", -1);
    

    The first parameter is namespace of android and src is the property name. This method return the image resource id if it found or it will return -1;

    0 讨论(0)
提交回复
热议问题