scaleType
resize bitmap:
int width = 1000;
int height = 500;
Bitmap resizeBitmap = Bitmap.createScaledBitmap(oldBitmap, width, height, true);
JAVA:
categoryButton.setScaleType(ImageView.ScaleType.FIT_XY );
XML:
<ImageButton
android:id="@+id/foodDetailBigBut"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="@+id/foodDetailViewPager"
android:layout_alignLeft="@+id/foodDetailViewPager"
android:src="@drawable/bigbut"
android:scaleType="fitXY"
android:background="@android:color/transparent"
/>
維持比例縮放: centerCrop & centerInside
不維持比例,縮放到指定的大小: fitXY
沒有留言:
張貼留言