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. product graph

any ideas what this does and how to invoke it ?

build/core/tasks/product-graph.mk

-Dan

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Prospek Android di Indonesia? (Was: IWIC indosat)

Prospek Android di Indonesia? Hmm.. oke.. saya coba tanya satu hal dulu, di
Indonesia itu pasarnya seperti apa yah? mksdnya orang yng bakal beli itu
orang2 yg seperti apa?

Masalahnya mnrt gw Android itu sampai saat ini cuma cocok buat Gadget
enthusiast.. or a Geek like me :D
Android walau dengan ataupun tanpa GMS mnrt gw sampai saat ini blm terlalu
user friendly.

Kita coba aja taro sebuah test simple.. pinjemin ponsel Android ke temen
kita yg ga tau apa2 soal Android, kita liat coba berapa lama orang itu bakal
tau klo Notification bar nya bisa di slide turun, or layarnya bisa di pan ke
kiri (ke kanan udah pasti bisa coz asumsi aja orang nya pernah make iPhone
:D ), gw pernah test ke temen gw pemakai iPhone, took him 10 minutes for him
to realize that he can pan the screen to the left & 60 minutes to pull down
the notification bar coz dia baru dapet SMS, tp itu juga sblmnya nanya
dulu,

"buka SMS gimana yah? harus dari Icon sms nya dulu?"


see? :D

Ok temen gw itu mgkn ga baca buku manual nya.. and probably none of us are,
tp bakal baca klo udah kepepet sih.. :P

The point is, coba deh di compare antara Android, iPhone, BB, WinMo or
Symbian.. mnrt gw Android masih asing banget bro.. dan pertama kali ngeliat
sama sekali ga familiar, beda sama iPhone or BB or etc :)

nah target pasar dari Android ini siapa? I wouldn't recommend Android phones
to my mom or my sister, tp gw pasti bakal nge-recommend ke orang2 yg minimal
suka gadget or orang2 yg paham teknologi :)

Regards,

Bayu Wicaksono

2009/11/3 Subanindiyo Ardi <subanindiyo.a...@gmail.com>


--~--~---------~--~----~------------~-------~--~----~
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group:

Click   http://www.***.com/ 
          Choice Apply for Group Membership

or 

 Please visit the following page:
  http://www.***.com/ 

To send a message to the owner, visit the following page:
  http://www.***.com/ ;hl=en-GB    or   
    id.andr...@gmail.com

For more options, visit this group at
 http://www.***.com/ 

To unsubscribe from this group, send email to
id-android+unsubscr...@googlegroups.com

Indonesian Android Community on Facebook

 http://www.***.com/ 
-~----------~----~----~----~------~----~------~--~---

3. is it possible to reference custom drawable from layout file?

4. Where to copy pictures so Gallery will show them?

5. Contacts code examples in 2.0

6. disable GPS programmatically

7. Possible bug with Intents and PendingIntents on Android 2.0 AVD