android怎么在imageview上添加view

如题所述

1、创建imageview对象

2、设置imageview的图片
3、添加到布局中
示例代码
ViewGroup group = (ViewGroup) findViewById(R.id.viewGroup); //获取原来的布局容器
ImageView imageView = new ImageView(this); //创建imageview
imageView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); //image的布局方式
imageView.setImageResource(R.drawable.ic_launcher); //设置imageview呈现的图片
group.addView(imageView); //添加到布局容器中,显示图片。
温馨提示:答案为网友推荐,仅供参考