2013-07-29 88 views
1

我實現了按鈕來在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

我搬到旋轉邏輯的AsyncTask