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=" http://schemas.android.com/apk/res/ 
android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/my_background">
    <ImageView ...
        android:id="@+id/my_imageview"
        android:src="@drawable/my_image" />
</RelativeLayout>

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 :

<ImageView
    ...
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="40dip"
    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 - MDPI : OK
- 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 !!
Regards

-- 



Other Threads

1. problem running android file system on realview kernel. init gives kernel panic

Hi
i'm porting Android file system to to realview ARM sytem. facing
issues after init is found.
After init is detected by realview ARM kernel, there is a kernel panic
as shown below.

VFS: Mounted root (nfs filesystem).
[   45.462122] VFS: Mounted root (nfs filesystem).
<6>Freeing init memory: 136K
[   45.484418] Freeing init memory: 136K
<4>Warning: unable to open an initial console.
[   45.510378] Warning: unable to open an initial console.
<0>Kernel panic - not syncing: Attempted to kill init!
[   45.747555] Kernel panic - not syncing: Attempted to kill init!

I download kernel from Android GIT and the kernel version is 2..6.27.
If anybody i facing similar issue and found solution, please share the
solution.
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. need a help about sensor

hi everybody
i'm a new android developer, i'm from tunisia
i have a question about the accelerometer integrated into new mobiles.
i want to know how it work? if possible a sample android code that
demonstrate how to use the package
android.hardware.sensormanager to manipulate the accelerometer and get
the followings results :
the actual direction of the mobile (vertical, horizontal) ?
the actual mobile's orientation ( mobile is turned left, right, ...)

waiting from you any response.
thank you.

--~--~---------~--~----~------------~-------~--~----~

3. questions

4. Interested in making core revision to IM for Groupwise Messenger support (got permission from novell)

5. Question regarding adding a view that can overlap other views in the layout/activity.

6. Running Android SDK 1.1 R1 on Linux 64 bit Fedora 11 RawHide

7. How to add text in ImageButton