我有一个 Imageview,activity_main.xml
我想从这个不同的位置画两个。我试过这个没有成功:
image = (ImageView)findViewById(R.id.imageView1);
image2 = (ImageView)findViewById(R.id.imageView1);
LayoutParams params = (LinearLayout.LayoutParams) image.getLayoutParams();
LayoutParams params2 = (LinearLayout.LayoutParams) image2.getLayoutParams();
params.topMargin = 50;
params.leftMargin = 50;
image.setLayoutParams(params);
params2.topMargin = 100;
params2.leftMargin = 100;
image2.setLayoutParams(params2);
它只画了一块。我也试过setImageBitmap
:
image2.setImageBitmap(((BitmapDrawable)image.getDrawable()).getBitmap());
我应该如何解决这个问题?