wocmultimedia
wocmultimedia

Reputation: 269

how to eliminate black border around the picture

I need to remove the black borders appears around the pictures in android screen. My pcture are full blade but I always get a kind of black borders both in portrait or landscape orientation. I tried to change parameters but unsuccessfully. 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 to find the error? Pictures are bigger than the screen 480x320 - 800x480 - 1280x800

enter image description here

Thank you

Upvotes: 4

Views: 4983

Answers (1)

PravinCG
PravinCG

Reputation: 7708

If by black border you mean the empty space around your picture left and right in landscape then you need to set ScaleType in you imageView Tag.

The first one will stretch the image and not preserve aspect ratio

android:scaleType="fitXY" 

this one will zoom in to the image till all the sides are filled and it preserves aspect ratio.

android:scaleType="centerCrop"

Upvotes: 5

Related Questions