Problem when dealing with multiple screen sizes

by lou » Fri, 20 May 2011 18:04:16 GMT

Sponsored Links
 Hi !
I have some problems when dealing with different resolutions and sizes
of screen : my goal is to display an image in a square which is draw
in my background picture.
I have a main RelativeLayout which is filling the entire screen :

<RelativeLayout xmlns:android=" 
    <ImageView ...
        android:src="@drawable/my_image" />

In my background picture, there is a square ( for example at 10px from
the left and 40px from the top of the picture ). I want to display the
ImageView my_imageview IN this square.
In my manifest :

    <supports-screens android:normalScreens="true" />
    <supports-screens android:largeScreens="true" />
    <supports-screens android:smallScreens="true" />
    <supports-screens android:anyDensity="true" />

I tried to set my_imageview parameters like that :

    android:layout_marginLeft="10dip" />

But even with 3 types of drawable ( hdpi -> 1.5x, mdpi -> 1x, ldpi ->
0.75x), the imageview is not always displayed in the square.
For this  example :
- HVGA - HDPI : the imageview is underneath the square
- WVGA - HDPI : the imageview is a little over the square
- WVGA - HDPI : the imageview is a lot over the square
I also tried to set the layout_marginTop and the layout_marginLeft
three times ( values-small, values-normal, values-large ), but there
are still some bugs..

Is there anybody who can help me with that ?

Thanks, a lot !!


Other Threads

1. Using the Android Camera

Hey everyone, Im having some trouble using the camera. I am able to
call the camera using an Intent but the image that gets saved is not
the file name i supply and the quality is terrible. Is there a way I
can simply call the camera app let it take a picture and save it just
like it would if I were to open the camera app directly. After the
picture is saved I simply just need the location and image name of the
file returned to me.

Is this possible? Any good tutorials on getting JUST the image
location and File name?

Thanks for your help,



2. System not support the long-pressed behavior entering screen-off mode

Hi All,

In default behavior, I found system not supprot the long-pressed
behavior entering screen-off mode based on OS Donut or Eclair. I tried
to set the wake flag in the KeyMapLayout config, and it didn't work.

If adding the long-pressed behavior in this scenario, any suggestion
for this issue?

Many Thanks,


3. sysinfo function porting to NDK

4. Parsing HID report using hid class driver

5. Trouble debugging application on device

6. Stop LBS service programmatically

7. Android eclair 2.1 - problem to get dns through dhcpcd in wifi network