Android Room BitMap Image ImageView размыто, когда его выбирают из базы данных - PullRequest
0 голосов
/ 13 октября 2018

Я использую комнату Android и я сохранил информацию об элементе в базе данных.Когда я выбираю данные из базы данных room и присваиваю BitMap в ImageView, изображение выглядит размытым.

 @ColumnInfo(typeAffinity = ColumnInfo.BLOB)
    private byte[] image;
this is image column declared in my item entity class. @Entity

 //Create Bitmap with width, height, and 4 bytes color (RGBA)
            Bitmap bmp = Bitmap.createBitmap(20, 20, Bitmap.Config.ARGB_8888);
            ByteBuffer buffer = ByteBuffer.wrap(item.getImage());
            bmp.copyPixelsFromBuffer(buffer);
  holder.imageViewItem.setImageBitmap(bmp);

ImageView макет XML:

 <ImageView
        android:id="@+id/imageViewItem"
        android:layout_width="182dp"
        android:layout_height="103dp"
        android:layout_above="@+id/textViewPrice"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_alignParentEnd="true"

        android:layout_alignParentRight="true"
        android:layout_marginStart="40dp"

        android:layout_marginLeft="40dp"
        android:layout_marginTop="24dp"
        android:layout_marginEnd="146dp"
        android:layout_marginRight="146dp"
        android:layout_marginBottom="28dp"
        android:adjustViewBounds="true"
        android:scaleType="centerCrop"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.363"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0"
        app:srcCompat="@drawable/ic_baseline_image_24px" />

Это вывод, который я получаю в ImageView, изображение размытое.

This is the output I get in the ImageView, the image is blurry.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...