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. adjust pivot point in ImageView

In an image view, the pivot point, or anchor, or whatever, defaults to
upper left.  How can I change that so that it is, say at 10,10, or
something.  When I place it somewhere on the screen, I want that point
to be the thing that I am positioning.  Thanks


2. automatic launch for google maps

does anybody knows how to change the default choice between goggle map application and google maps via internet when you click an link like :

the system ask you if you want to open it via maps google  internet or via google maps application and ask you if you always want the same choice.

I cant find a way to change the choice it's not in the default setting of google maps, nor in the default setting of the browser (not the ones you can erase), not in you google map account page

if anybody knows ,

thank you
JF Pion "If a cluttered desk is sign of a cluttered mind, of what, then, is an empty desk a sign ? " Albert Einstein

Errare humanum est, perseverare politicum

"La théorie, c'est quand on sait tout et que rien ne fonctionne. La
pratique, c'est quand tout fonctionne et que personne ne sait pourquoi. Ici,
nous avons réuni théorie et pratique : Rien ne fonctionne... et personne ne
sait pourquoi !"

Albert Einstein

Abuser de la confiance d’autrui en dehors du cadre d’un contrat n’est pas un délit, mais de la politique......

Un simple écrit mensonger ne constitue pas un faux mais un programme électoral.......

le 6/10/10

des montages électroniques pour le modélisme
le site du vol électrique


3. Simple question (but I hav'nt found any useful answer )

4. Digest for -25 Messages in 21 Topics

5. Problem with dynamically adding shapes

6. Android - embedding ListView inside Gallery

7. OOT: Happy Birthday Bang Renner CHEN (BRC)