如何动态设置特定位置的图像

时间:2013-02-26 13:36:36

标签: android

基本上我想要翻转图像。现在我想要的是在屏幕上动态地设置特定位置的图像。示例代码是:

ImageView im=new ImageView(MainActivity1.this);

int location[]={1,2} ;
v.getLocationOnScreen(location);
Toast.makeText(getApplicationContext(), ">>>>>>>>>>"+location[0], 3000).show();
System.out.println(">>>>>>>>>>>"+location[0]);
v.setDrawingCacheEnabled(true);
v.buildDrawingCache();
bmp = v.getDrawingCache();
if(bmp.equals(null))
{
     Toast.makeText(getApplicationContext(), "No Image Selected!!!", 3000).show();
}
else
{
     r = r + 1;
     matrix.postRotate(360);
 matrix.postScale(-1.0f, 1.0f);
     mBitmap = Bitmap.createBitmap(bmp, 0, 0, 80,80, matrix, false);
 im.setImageBitmap(mBitmap);
}

0 个答案:

没有答案