Reputation: 1080
I have image colors, (161 * 96 = 15456).
I hold it in integer array, and i create a bitmap :
conf = Bitmap.Config.ARGB_8888;
bm = Bitmap.createBitmap(161, 96, conf);
I draw point by point on canvas and assign to bm
(bitmap) :
canvas.drawPoint(i, j, paint);
canvas.setBitmap(bm);
Finally, i set the imageView :
imgPreview.setImageBitmap(bm);
It works perfectly, but my original imageView size 1200 * 900. So I want to stretch my bitmap. But i dont know, how can i do this because i draw point by point.
Are there any method to stretch bitmap in image view ?
Upvotes: 2
Views: 49
Reputation: 31
add this code in your image View
<ImageView android:scaleType="centerCrop" ../>
Upvotes: 0
Reputation: 4375
You can use ScaleType programatically in a ImageView
imagePreview.setScaleType(ImageView.ScaleType.CENTER_CROP);
Upvotes: 2
Reputation: 10279
You can use the ImageView attribute android:scaleType. http://developer.android.com/reference/android/widget/ImageView.html#attr_android:scaleType
e.g. in your xml:
<ImageView
android:scaleType="fitXY"
...
/>
Upvotes: 0
Reputation: 1808
in yout imageview xml tag, use the below code
android:scaleType="centerCrop"
Upvotes: 0
Reputation: 31458
You can use the ImageView
's setScaleType(...)
method.
Use one of the FIT
or CENTER_CROP
parameters from ImageView.ScaleType
depending on your needs.
EDIT:
Probably you want FIT_CENTER
Upvotes: 0