0
sorry to ask question already asked. but i am helpless
in my programi have 27 imageview's which can display any of the 3 drawable's i have in my drawable's folder.. and i want these imageview's click to perform a different action for each drawable they contain..but i found that we won't be able to compare two drawable's for equality....
這是我寫的代碼,沒有工作....檢查條件(繪製==繪製)
如果(((ImageView的)爲arg0).getDrawable()!= getResources( ).getDrawable(R.drawable.sq))
我已經使用了它,但沒有人清楚....他們說我們可以使用setTag()方法,但我無法弄清楚如何。所以請可憐我,告訴我如何使用setTag()來解決我的問題,例如
繪製與它沒有setTag()方法......,看起來像你不力ustand我的問題..或我dint ustand你的答案...所以PLZ給我一個小例子... wud是一個GR8的幫助 – vivek 2011-05-05 07:06:36
我知道drawable沒有setTag()方法,我說的ImageView顯示drawable。對於每個ImageView,當您實例化它時,您可以設置它的標籤以輕鬆識別它顯示的繪圖。上面的代碼將變成: 'if((String)((ImageView)arg0).getTag()== DRAWABLE_SQ_TAG)' – Moystard 2011-05-05 08:28:15
moystard,非常感謝您試圖回答...但我仍然努力讓你.. ..我得到的部分是:「當你實例化它時,你可以設置它的標籤來容易地識別它顯示的可繪製的」..怎麼?.try用一個例子來詳細說明它...... wud luv tht .. – vivek 2011-05-05 17:34:18