我們可以刪除/清除先前設置的TAG到視圖嗎?

[英]Can we remove/clear a previously set TAG to a view?


I am wondering if there is a way to clear completely (instead of just overwrite) a previously set tag to a view via view.setTag(SOME_KEY,value) the docs of view.getTag(SOME_KEY) says that in case SOME_KEY is not found, the method returns null, i know it's possible to overwrite with some other value if we wanted to test but i want to know if it's possible to completely delete the tag once we're done with it.

我想知道是否有辦法通過view.setTag(SOME_KEY,value)完全清除(而不是僅覆蓋)先前設置的標簽到視圖.view.getTag(SOME_KEY)的文檔說如果找不到SOME_KEY ,該方法返回null,我知道如果我們想測試可以用其他值覆蓋,但我想知道一旦完成它就可以完全刪除標記。

1 个解决方案

#1


8  

Setting null as the View tag essentially removes the one you could have set previously :

將null設置為View標記實際上會刪除您之前可以設置的那個:

view.setTag(null);

or if you use keys

或者如果你使用鑰匙

view.setTag(key, null);

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2014/10/29/7204fa05d15b13589823f2aa36e6b0c0.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com