首先,您需要创建一个imageview。
ImageView imageView = new ImageView(getApplicationContext());
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
然后获取您的图像路径
String path = Environment.getExternalStorageDirectory() + "/your folder name/image_name.bmp";
在ImageView上设置图像
Bitmap image = BitmapFactory.depreFile(path);imageView.setImageBitmap(image);
获取您要添加的布局
RelativeLayout rl = (RelativeLayout) findViewById(R.id.relativeLayout1);
将视图添加到布局
rl.addView(imageView, lp);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)