-1

I'm trying to set 1080*1920 image in imageview but it showing white space left and right side. It showing same in all device having resolution of 480*800,720*1280,768*1280,1080*1920,1440*2560. Please check attached image Also, i tried to set android:adjustViewBounds="true" but it didn't work if i set android:scaleType="fitXY" image is streched. Please help me with some solution as i'm trying all possible way but not worked till now.
enter image description here

This is xml layout code :
    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/img_gallery1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:src="@drawable/atest"
        android:scaleType="fitXY" --> iF i use fitXY then image is streched
        android:visibility="visible" />
</RelativeLayout>
Mehul Ranpara
  • 4,245
  • 2
  • 26
  • 39

2 Answers2

0

Try:

android:layout_width="wrap_content"  

or:

android:layout_width="match_parent"

also make sure whichever container you have the imageview inside is able to fill the full screen.

0

The resolution you mentioned i.e 1920x1080 is ideally a landscape resolution.

So if you intend to put the image in portrait mode, then try changing the resolution of image to 1080x1920.

Also, as Philip said, make sure the imageview's container is able to fill the screen.

Jubin Mathai
  • 101
  • 5