How to eliminate the black border around the image

I need to remove the black borders around the images on the android screen. My pcture is a complete blade, but I always get the appearance of black borders in both portrait and landscape orientation. I tried to change the settings, but to no avail. this is my xml layout code

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <ImageView android:src="@drawable/map" android:id="@+id/fullmap" android:layout_height="fill_parent" android:layout_width="fill_parent"> </ImageView> </LinearLayout> 

Can someone help me find a bug? Pictures larger screen 480x320 - 800x480 - 1280x800

enter image description here

thanks

+4
source share
1 answer

If the black frame means the empty space around your image left and right in the landscape, you need to set ScaleType in the imageView image tag.

The first will stretch the image and not maintain aspect ratio

 android:scaleType="fitXY" 

this one will be enlarged to the image until all sides are filled, and it will keep the proportions.

 android:scaleType="centerCrop" 
+5
source

All Articles