我有两个ImageView。在一个ImageView我正在加载图像。我有另一个ImageView。
我需要在不同的imageView中显示onther imageView的图像。
ImageView imgview = (ImageView) v.findViewById(R.id.imgview);
ImageView imgview1 = (ImageView) findViewById(R.id.mainImage);
我有GridView,因为我在“imgview”对象中设置了多个图像。
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final GridView gridview = (GridView) findViewById(R.id.gridview);
btnSubmit = (Button) findViewById(R.id.editButton);
txtinfo = (TextView) findViewById(R.id.txtInfo);
btnSubmit.setOnClickListener(this);
gridview.setAdapter(new ImageAdapter(this, status));
gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
ImageView imgview = (ImageView) v.findViewById(R.id.imgview);
ImageView imgview1 = (ImageView) findViewById(R.id.mainImage);
imgview.setImageResource(R.drawable.check_box_checked);
// imgview1.setImageBitmap( i have to load image of imageview object);
}
});
}
请帮帮我......谢谢..
答案 0 :(得分:0)
ImageView imgview = (ImageView) v.findViewById(R.id.imgview);
ImageView imgview1 = (ImageView) findViewById(R.id.mainImage);
imgview.setImageResource(R.drawable.check_box_checked);
bitmap b = BitmapFactry.decodeResource(your resource, your ID);
imageView1.setimageBitmap(b);
答案 1 :(得分:0)
我认为你应该能够提取位图:
imageView.buildDrawingCache();
Bitmap bmap = imageView.getDrawingCache();
然后导入位图:
imageView1.setimageBitmap(bmap);
答案 2 :(得分:0)
ImageView grid_item_image = (ImageView)v.findViewById(R.id.grid_item_image);
grid_item_image.buildDrawingCache();
Bitmap bmap = grid_item_image.getDrawingCache();
ivLogoDialog = (ImageView)dialog_layout.findViewById(R.id.ivLogoDialog);
ivLogoDialog.setImageBitmap(bmap);