Search code examples
androidandroid-studiolayoutandroid-imageviewandroid-drawable

Image is shown as blurred in ImageView while using mipmap resource directory


While loading image in ImageView for Android Studio using android:src="@mipmap/stunner my image is getting blurred out, What to do?? Please help...

My code is as follows:

<ImageView
    android:src="@mipmap/stunner"
    android:adjustViewBounds="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="2dp"/>

The screenshot of my Android Studio layout

The image I want to load


Solution

  • Please use it as a drawable rather than using it as a mipmap. Mipmap is used for app icons but not for drawables

    Here is the code and output with drawable

    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/archive_task_open_btn"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="visible">
    
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="2dp"
            android:adjustViewBounds="true"
            android:src="@drawable/bg" />
    </FrameLayout>
    

    Screenshot