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. Waiting for root device /dev/mmcblk0p1

Hello all,
               I am trying to port Android to Hawkboard. Using SD card to
load my filesystem. Created a bootable partition in SD card mmcblk0p1.
Copied my filesystem. After inserting in the target board, when booting i am
getting the following boot log. My SD card is not being detected. Here is my
log,

--------------------------------------------------------------------------------------------------------------------------
hawkboard.org > bootm c0700000
## Booting kernel from Legacy Image at c0700000 ...
   Image Name:   Linux-2.6.32-rc6-gfa4fa8b-dirty
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2115644 Bytes =  2 MB
   Load Address: c0008000
   Entry Point:  c0008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Linux version 2.6.32-rc6-gfa4fa8b-dirty (r...@prem-laptop) (gcc version
4.3.2 (Sourcery G++ Lite 2008q3-72) ) #12 PREEMPT Sun Aug 29 13:08:57 IST
2010
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: OMAPL 138 Hawkboard.org
Memory policy: ECC disabled, Data cache writeback
DaVinci da850/omap-l138 variant 0x0
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: console=ttyS2,115200n8 noinitrd root=/dev/mmcblk0p1
video=omapfb.mode=dvi:1280*720...@50 androidboot.console=ttyS2 rootwait rw
init=/init
Unknown boot option `androidboot.console=ttyS2': ignoring
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 124784KB available (4028K code, 797K data, 144K init, 0K highmem)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
NR_IRQS:245
Console: colour dummy device 80x30
Calibrating delay loop... 149.50 BogoMIPS (lpj=747520)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
DaVinci: 144 gpio irqs
regulator: core version 0.5
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource timer0_1
musb_hdrc: version 6.0, cppi4.1-dma, (host+peripheral), debug=0
Waiting for USB PHY clock good...
musb_hdrc: USB OTG mode controller at fee00000 using DMA, IRQ 58
musb_hdrc musb_hdrc: MUSB HDRC host driver
musb_hdrc musb_hdrc: new USB bus registered, assigned bus number 1
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
ashmem: initialized
Installing knfsd (copyright (C) 1996 o...@monad.swb.de).
JFFS2 version 2.2. (NAND) \0xc2\0xa9 2001-2006 Red Hat, Inc.
msgmni has been set to 244
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered (default)
da8xx_lcdc da8xx_lcdc.0: GLCD: Found VGA_Monitor panel
Console: switching to colour frame buffer device 80x30
Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a 16550A
serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a 16550A
serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a 16550A
console [ttyS2] enabled
brd: module loaded
console [netcon0] enabled
netconsole: network logging started
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci ohci.0: DA8xx OHCI
ohci ohci.0: new USB bus registered, assigned bus number 2
ohci ohci.0: irq 59, io mem 0x01e25000
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
g_ether gadget: using random self ethernet address
g_ether gadget: using random host ethernet address
usb0: MAC 8a:46:c4:64:eb:13
usb0: HOST MAC 3e:5f:7e:74:1b:c1
g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
g_ether gadget: g_ether ready
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
logger: created 64K log 'log_main'
logger: created 256K log 'log_events'
logger: created 64K log 'log_radio'
logger: created 64K log 'log_system'
Advanced Linux Sound Architecture Driver Version 1.0.21.
ALSA device list:
  No soundcards found.
TCP cubic registered
NET: Registered protocol family 17
Waiting for root device /dev/mmcblk0p1...
-------------------------------------------------------------------------------------------------------

My bootargs were, *setenv bootargs console=ttyS2,115200n8 noinitrd
root=/dev/mmcblk0p1
video=omapfb.mode=dvi:1280*720...@50androidboot.console=ttys2 rootwait
rw init=/init
*

Is there anything else that i am missing in boot arguments??

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

2. Please help me on Android.




-- 

3. Need Help.. File Explorer Working with Code

4. upload image to php server problem

5. Building Android Source code on 64bit amd ubuntu 9.10 karmic koala

6. Custom Service Permission

7. onSingleTapConfirmed and different screen sizes