1

i have a question about pictures in an ImageView in Android.

My problem is, that the pic i wanna show in my ImageView seems too big for my smartphone screen. Therefore it is not on the place i set in the xml...

Here is a pic that you know what i mean: http://www10.pic-upload.de/31.10.12/iuebxzkvr3e.png The grey area is my Banner which should be located on top of my activity... If i scale the pic, it should work (the smaller, the higher till it fits), but i think other smartphones with a different resolution should have the same problem again with my app..

Here is my XML:

<ImageView android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:id="@+id/ivBanner"
               android:src="@drawable/banner"/>

Nothing special.

thanks in advance

4

2 に答える 2

0

you can set scaleType for ImageView to fitXY, or centerCrop

android:scaleType = "fitXY"
于 2012-10-31T08:19:04.427 に答える
0

In your layout you should set its height and width to absolute dp values:

Here is a px to dp converter:

http://labs.skinkers.com/content/android_dp_px_calculator/

That solved the problem for me, for every screen size you need a different values(hdpi/xhdpi).

于 2012-10-31T08:22:30.447 に答える