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. Retrollect

Masih inget waktu kita kecil dan punya mainan buat lihat film slide, yg
filmnya berbentuk lingkaran dan alat untuk lihatnya seperti binocular
berwarna merah dgn tuas roll dikanan buat muter slidenya?

Nah di android (dan ipun) ada programnya untuk kita share foto2 kita dengan
menjadikannya kepingan disk, namanya retrollect dan free di market.

Hasil kepingan disk berisi foto2 kita bisa di share ke pengguna aplikasi
atau via web ke teman2, juga via fb dan twitter.

Cara baru yg keren untuk bercerita melalui gambar foto.

Ini saya coba bikin juga :-)
http://rtr.lc/895c01

So share your story with retrollect.

Salam,

Lucky Sebastian

-- 
"

2. WebMD Android App Now Available

Keren nih aplikasinya, saya dulu pakai di aipong. Untuk referensi
obat-obatan ;)

Sent to you by uam via Google Reader: WebMD Android App Now Available
via AndroidGuys by Phil Esposito on 5/11/11



According to the press release, WebMD (an online source for health
information) has just released their mobile application to the Android
Market. WebMD has received over 5 million downloads with their
application on the iOs platform. With this new Android application, you
can look up:

- Symptoms
- Drug treatment
- First Aid information
- Local health listings
If this application works like the WebMD website, it should be a hit.
If you want to download the app now, you can, we have provided a link
below for you to do so. Now that WebMD has released their application
to the Android OS, are you happy? Do you know any other health related
Android applications? Leave your thoughts below or on our Facebook wall!

conversione applicazioni iphone android
WebMD for Android
WebMD, LLC
FREE
10,000-50,000
Link Android Market | Link AppBrain



WebMD Android App Now Available originally appeared on AndroidGuys.
Follow us on Facebook and Twitter!

You May Also Enjoy...
- WebMD Launches Medscape for and AndroidDevices
- Sharp Extends Aquos Brand with New 3D Android Handset
- Android 3.1 SDK Overview


Things you can do from here:
- Subscribe to AndroidGuys using Google Reader
- Get started using Google Reader to easily keep up with all your
favorite sites

--
"

3. Best Way to Handle Chained Async HTTP?

4. Activity lifecycle: invoking finish

5. Nunggu Update firmare lagi..

6. menu item disabled, but clickable

7. "Authorizing purchase"