Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 更改ImageView的质量_Android_Imageview - Fatal编程技术网

Android 更改ImageView的质量

Android 更改ImageView的质量,android,imageview,Android,Imageview,我有一个宽度和高度为70dp的ImageView。它用于我的ListView,包含800x800的图像src 我现在的问题是,这张图片太大了,以至于在我的ImageView中看起来太尖锐了。 我怎样才能防止这种情况 <ImageView android:id="@+id/imageView_albumart" android:layout_alignParentLeft="true" android:layout_alignParentTop="true"

我有一个宽度和高度为70dp的ImageView。它用于我的ListView,包含800x800的图像src

我现在的问题是,这张图片太大了,以至于在我的ImageView中看起来太尖锐了。 我怎样才能防止这种情况

<ImageView
    android:id="@+id/imageView_albumart"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_width="70dp"
    android:layout_height="70dp"
    android:layout_marginRight="5dp"
    android:src="@drawable/cd_800x800" />

实际上,您可以播放位图。旋转、压缩、转换其他格式等。。 我们在下面的代码中将质量从100降低到25

这就是代码:

    Bitmap oldbitmap=Bitmap bitmap = ((BitmapDrawable)yourimageview.getDrawable()).getBitmap();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    oldbitmap.compress(Bitmap.CompressFormat.JPEG, 25,baos);
    Bitmap newbitmap=BitmapFactory.decodeStream(new ByteArrayInputStream(baos.toByteArray()));
    yourimageview.setImageBitmap(newbitmap);

这真的没有帮助我的图像视图仍然非常清晰。Yerim seniBitmap scaled=Bitmap.createScaledBitmap(您的位图,300300,true);这将把分辨率降低到300x300 bizdeçare tükenmez.谢谢你的帮助,但我想我必须把图片弄模糊一点,因为它仍然非常清晰。瓦萨·贝尼·阿德勒森·塞维尼林的埃瓦拉·卡尔德西姆: