本文介绍了如何将Object Array转换为ImageView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public int[] object = new int[] { R.drawable.line1,R.drawable.line2}; //line1,2 is image line1.png and line2.png
隐藏到imageview 并点击显示并隐藏图片
covert to imageview and click for show and hide image
Button button1 = (Button)findViewById(R.id.button1); button1.setOnClickListener(new OnClickListener() { public void onClick(View v) { imgView .setVisibility(View.VISIBLE); } }); Button button2 = (Button)findViewById(R.id.button2); button2.setOnClickListener(new OnClickListener() { public void onClick(View v) { imgView .setVisibility(View.INVISIBLE); } });推荐答案
试试这个... Just try this... imgView.setImageResource(object[i]); // i is index
更多推荐
如何将Object Array转换为ImageView?
发布评论