我实现了在galleryview中旋转图像的按钮,但有时候它的工作速度会逐渐变慢。我可以占用20秒。有没有办法加快速度或以更好的方式实施呢?
我的代码
gallery.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view,
int position, long id) {
onFront = (ImageView) view;
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
}
public void rotateS(View v) {
ImageView iv = onFront;
Bitmap b = ((BitmapDrawable) iv.getDrawable()).getBitmap();
Matrix matrix = new Matrix();
matrix.postRotate(geg);
Bitmap bMapRotate = Bitmap.createBitmap(b, 0, 0, b.getWidth(),
b.getHeight(), matrix, true);
iv.setImageBitmap(bMapRotate);
geg = 90;
Log.d("rorate", "yes");
}
答案 0 :(得分:0)
我将旋转逻辑移到了asyncTask