您好,我需要在我的應用程序的觸摸如何在兩個方向旋轉圖像的Android
旋轉的ImageView的,我用下面的代碼
public android.view.View.OnTouchListener onTableTouched = new android.view.View.OnTouchListener(){
public boolean onTouch(View v, MotionEvent evt) {
WrapMotionEvent event = WrapMotionEvent.wrap(evt);
ImageView view = (ImageView) v;
// Dump touch event to log
dumpEvent(event);
//
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
break;
case MotionEvent.ACTION_POINTER_DOWN:
mode = NONE;
break;
case MotionEvent.ACTION_UP:
break;
case MotionEvent.ACTION_MOVE:
if(mode == NONE){
updateRotation();
}
break;
}
return true;
}
};
private void updateRotation()
{
matrix.postRotate(10);
Bitmap redrawnBitmap = Bitmap.createBitmap(itembmp, 0, 0,itembmp.getWidth(), itembmp.getHeight(), matrix, true);
itembmp=redrawnBitmap;
image.setImageBitmap(itembmp);
}
而是利用這個我可以旋轉僅在時鐘方向上的圖像。
但我需要在兩個方向旋轉圖像。
如何做到這一點。
你想申請什麼旋轉邏輯? (一般來說,你應該給你的'postRotate()'func)一個負值 – MeLight
如何通過onTouchListener知道它是順時針還是逆時針旋轉 – surendra
所以你想知道如何知道如何應用旋轉?換句話說,屏幕在哪裏? – MeLight