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. FroYo Alsa issues

hello again all, I'm working on porting froyo to n900 (trying to keep
to porting the latest version) but for some reason (could be due to
using the eclair alsa files since their are no froyo ones) i get the
following build errors? any ideas how I can fix ?




target arm C++: libaudio <= hardware/alsa_sound/AudioHardwareALSA.cpp
hardware/alsa_sound/AudioHardwareALSA.cpp: In member function 'virtual
android::AudioStreamOut*
android::AudioHardwareALSA::openOutputStream(uint32_t, int*,
uint32_t*, uint32_t*, android::status_t*)':
hardware/alsa_sound/AudioHardwareALSA.cpp:190: error: cannot allocate
an object of abstract type 'android::AudioStreamOutALSA'
hardware/alsa_sound/AudioHardwareALSA.h:163: note:   because the
following virtual functions are pure within
'android::AudioStreamOutALSA':
hardware/libhardware_legacy/include/hardware_legacy/
AudioHardwareInterface.h:104: note:         virtual android::status_t
android::AudioStreamOut::getRenderPosition(uint32_t*)
hardware/alsa_sound/AudioHardwareALSA.cpp: In member function 'virtual
android::AudioStreamIn*
android::AudioHardwareALSA::openInputStream(uint32_t, int*, uint32_t*,
uint32_t*, android::status_t*,
android::AudioSystem::audio_in_acoustics)':
hardware/alsa_sound/AudioHardwareALSA.cpp:230: error: cannot allocate
an object of abstract type 'android::AudioStreamInALSA'
hardware/alsa_sound/AudioHardwareALSA.h:207: note:   because the
following virtual functions are pure within
'android::AudioStreamInALSA':
hardware/libhardware_legacy/include/hardware_legacy/
AudioHardwareInterface.h:166: note:         virtual unsigned int
android::AudioStreamIn::getInputFramesLost() const
make: *** [out/target/product/n900/obj/SHARED_LIBRARIES/
libaudio_intermediates/AudioHardwareALSA.o] Error 1
make: *** Waiting for unfinished jobs....

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

2. boot speed -- scan package, IO buffering, and prefetch

Hello,

It seems package scanning speed is greatly influenced by IO buffering:

I did some simple experiment. I am testing with a fresh build so there
are NO apps under /data/app.

First boot up the phone. Then do either (A) or (B):

(A):

# stop
# sync; echo 3 > /proc/sys/vm/drop_caches
# start

(B):

# stop
# sync; echo 3 > /proc/sys/vm/drop_caches
# cat /system/app/*.apk > /dev/null
# start

case (A):     I/PackageManager( 3114): Time to scan packages: 12.668
seconds
case (B):     I/PackageManager( 3189): Time to scan packages: 7.032
seconds

Can PackageManagerService be easily reworked so that it pre-fetches
the buffers for the "next app to scan" in a separate thread?

I can't just blindly run a "cat /system/app/*.apk > /dev/null" before
package scanning happens, because doing so would cost more time than
the saving indicated from above ....

Thanks!

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

3. Questions for the group regarding URL Launchers

4. download android 2.2 failed because of "File too large6"

5. UI Stack over flow

6. How to simulate a SMS

7. How does forceStopPackage work in Android 2.2 (Froyo)?