开发者

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

how to eliminate black border around the picture

Thank you


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"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜