开发者

android: get imageview in 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜