Making Android apps that scale

95 views
Skip to first unread message

Gareth Murfin

unread,
Oct 11, 2013, 12:53:08 AM10/11/13
to codenameone...@googlegroups.com
Ive got a main menu going in CN1, looks great on my 480x800 nexus, but when tried on a 1080x1920 emulator, my same menu is tiny and in the middle of the screen. I expected this infact, but I was just wondering if somehow CN1 did some magic to make it automatically work, guess not :)

What is the prefferred way to make apps scale to any screensize on CN1? Are you meant to simply supply 3 sets of graphics so that things will scale up that way? And if so, how do you supply alternative graphics like this? 3 different resource files and assign the right one at run time based on screensize? Or something else?

Is there any other way to make things scale up automatically on HD devices or tablets etc?

Im assuming this question is pretty much applicable to apps unning on iphone as opposed to ipad, how do they scale ? 

Thanks very much, getting quite into CN1 now :-) as ever im on the IRC channel but no one is here apart from DigNZ who is idling, feel free to join me!!
Gaz.

Shai Almog

unread,
Oct 11, 2013, 2:35:54 AM10/11/13
to codenameone...@googlegroups.com
All our apps scale automatically when built with multi-images, 9-piece borders etc. Check out our demos and How Do I? tutorials.
This is more advances than what we had in the LWUIT days.

Gareth Murfin

unread,
Oct 11, 2013, 2:54:04 AM10/11/13
to codenameone...@googlegroups.com
Hey Shai,

Wow thats very cool, you invented this type of image? So if I add a high res high dpi image as a multi-image then everything will be scaled for me? Thats cool I will try it out!..

Gareth Murfin

unread,
Oct 11, 2013, 3:07:03 AM10/11/13
to codenameone...@googlegroups.com
Was just wondering how this scaling is done, because I intend to support iOS/Android but also old Blackberrys - would it be too much a struggle for blackberry if I used very hig hres images and add them as multi images? Would the old devices (J2ME standard) be able to handle this or would it make things incredibly slow ? I love the multiimages by the way, solves a lot of painful hassle.

Shai Almog

unread,
Oct 11, 2013, 3:21:53 PM10/11/13
to codenameone...@googlegroups.com
There is no scaling. Its exactly like Android's multiple directories for DPI resolutions only we generate the images for you on the desktop (you can set them one by one like in Android if you prefer.
The size of the resource files does grow so if you want to target J2ME we suggest you create a separate resource file where you use the advanced menu option to delete unnecessary DPI's.

Gareth Murfin

unread,
Oct 11, 2013, 7:29:43 PM10/11/13
to codenameone...@googlegroups.com
Thanks again my friend, Im falling in love with your CN1.. :)
Reply all
Reply to author
Forward
0 new messages