开发者

android: get imageview in code

开发者 https://www.devze.com 2023-01-20 03:23 出处:网络
how can i get a variable on the imageview that i have d开发者_JAVA百科efined in a layout.xml in the code?

how can i get a variable on the imageview that i have d开发者_JAVA百科efined in a layout.xml in the code?

thanks!


Give the ImageView an id and then use the findViewById() method

 ImageView view = (ImageView)findViewById(R.id.someid);

Note, the findViewById() method has to be called from a Context object (Activity, etc)

0

精彩评论

暂无评论...
验证码 换一张
取 消