我想從使用vectordrawable資源的imageview中獲取位圖,該資源在X或Y軸上旋轉,但位圖質量不佳。沒有旋轉或「setRotation」的質量是好的,但是當我使用「setRotationX」或「setRotationY」或Camera旋轉時,位圖質量下降。這個問題只是當我設置「setImageResource」爲一個vectordrawable,JPEG或PNG圖像沒有這個問題。我認爲這是對vectordrawable一個bug ......使用vectordrawable資源從imageview獲取位圖
這是我的代碼得到一個位圖:
itemBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(itemBitmap);
cv.save();
imageView.draw(canvas);
cv.restore();
轉換爲位圖並不能幫助我,因爲我需要調整imageview的大小和向量不會失去它的質量,如果我想使用位圖,我沒有使用向量!我之前測試過硬件加速並且沒有影響,所以imageView.draw(canvas)的位圖質量比getDrawingCache()好,因此我使用imageView.draw(canvas) – XDelta