Removing Opaque Spaces in ListView Images

I am presenting a ListView consisting of an image. I want to get rid of the gray plane. How can I get rid of this? It seems to be strange and rather easy, but I can not understand the solution.

enter image description here

list_View.xml

 <?xml version="1.0" encoding="UTF-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#efefef" android:orientation="vertical" > <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:cacheColorHint="#00000000" android:divider="@android:color/black" android:dividerHeight="1.0sp" android:textColor="#000000" /> </RelativeLayout> 

image.xml

 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#A4A4A4" android:orientation="horizontal" > <ImageView android:id="@+id/imageStatus" android:layout_alignParentTop="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" /> </LinearLayout> 
+4
source share
3 answers

 <ImageView android:id="@+id/imageStatus" android:layout_alignParentTop="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scaleType="fitXY" <!-- This will Help you --> android:adjustViewBounds="true" /> 

You can also set the minimum width and height using →>

 android:minHeight="120dp" android:minWidth="100dp" 
+3
source

Change the code in the list:

 android:layout_height="wrap_content" 
+2
source

try this as an attribute of your image.

 <?xml version="1.0" encoding="utf-8"?> <LinearLayout ...> <ImageView ... android:scaleType="matrix" /> </LinearLayout> 
+1
source

Source: https://habr.com/ru/post/1493117/


All Articles