android bitmap 失真,Bitmap.createScaledBitmap 失真
1.问题:就算换了小图标失真selectedBitmap = Bitmap.createScaledBitmap(selectedBitmap, (int) pieceWidth, (int) pieceWidth, true);unSelectedBitmap = Bitmap.createScaledBitmap(unSelectedBitmap, (int) pieceWidth, (int
1.问题:就算换了小图标失真
selectedBitmap = Bitmap.createScaledBitmap(selectedBitmap, (int) pieceWidth, (int) pieceWidth, true);
unSelectedBitmap = Bitmap.createScaledBitmap(unSelectedBitmap, (int) pieceWidth, (int) pieceWidth, true);
selectedBitmapSmall = Bitmap.createScaledBitmap(selectedBitmapSmall, (int) pieceWidthSmall, (int) pieceWidthSmall, true);
unSelectedBitmapSmall = Bitmap.createScaledBitmap(unSelectedBitmapSmall, (int) pieceWidthSmall, (int) pieceWidthSmall, true);
2.解决: boolean---->true
public static Bitmap createScaledBitmap(@NonNull Bitmap src, int dstWidth, int dstHeight,
boolean filter)
3.这个方法介绍:
https://www.android-doc.com/reference/android/graphics/Bitmap.html#createScaledBitmap(android.graphics.Bitmap, int, int, boolean)
中文:创建一个新的位图,从现有的位图缩放,如果可能的话。
中文:创建一个新的位图,从现有的位图缩放,如果可能的话。如果指定的宽度和高度与源位图的当前宽度和高度相同,则返回源位图,并且不创建新的位图。
更多推荐
所有评论(0)