安卓的ImageButton - 确定哪些资源当前设置的 [英] Android ImageButton - determine what resource is currently set
本文介绍了安卓的ImageButton - 确定哪些资源当前设置的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法可以让我找到什么资源特定的ImageButton被设定为,在任何给定的时间?
Is there a way I can find what resource a particular ImageButton is set to, at any given time?
有关,例如:我有我设置为 R.drawable.btn_on
的onCreate一个ImageButton的。后来,在某些时候,ImageButton的被设置为 R.drawable.btn_off
。我希望能够检查什么资源的ImageButton设置为我的code。
For eg: I have an ImageButton that I set to R.drawable.btn_on
onCreate. Later, at some point, the ImageButton gets set to R.drawable.btn_off
. I want to be able to check what resource the ImageButton is set to in my code.
谢谢 克里斯
推荐答案
只需使用 setTag()
和 getTag()
关联和检索自定义的数据为您的ImageView
。
Just use setTag()
and getTag()
to associate and retrieve custom data for your ImageView
.
这篇关于安卓的ImageButton - 确定哪些资源当前设置的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文