Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 58

krompa
Lost but trying
Profile
Posts: 257
Reg: Jun 14, 2013
Bristol
8,820
10/28/13 09:10 AM (12 years ago)

Android Screen Layout Debate

I love Android - generally cheaper and no big apple man telling me what to do etc. However, the variation in screen sizes and resolution is no doubt a problem for app developers. E.g. I am developing a quiz app using the BT quiz plug-in and have noticed the difference in layout when testing on various devices. I can get a typical quiz screen looking perfect on my device but it's a bit 'squashed up' on the latest (high res) devices. How can I retain that perfect looking relative layout? Is android:layout_weight the answer? In simple terms the developer provides a size weighting to each element within the layout. So for a quiz question screen, the weightings could be something like this: NavBar - 10% Text or picture question - 35% Answer Button 1 - 10% Answer Button 2 - 10% Answer Button 3 - 10% Answer Button 4 - 10% Which leaves 15% for an ad banner at the bottom of the screen Total = 100% So, irrespective of the screen resolution, the relative size of each element remains consistent. I would love to hear from you if you have used layout_weight or have other ideas for solving this problem - which can only become more apparent as more android devices come on the market and the difference between high and low res screens becomes greater. I haven't mentioned text size or portrait/landscape issues, but feel free to.
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
10/28/13 10:44 AM (12 years ago)
Android may need to have multiple layout files. So in addition to the multiple drawable files, it seems best practice is to use multiple layout files. http://developer.android.com/guide/practices/screens_support.html#DeclaringTabletLayouts I hope this helps. I haven't tried it with the quiz, just with the header images.
 
Sandeep
Android Fan
Profile
Posts: 1260
Reg: Feb 01, 2012
Miraj, India
25,250
like
10/28/13 11:48 AM (12 years ago)
I have never tried the approach of using layout weight. Instead i do use 3 different layouts in most (not all) of my android apps. One is the regular layout in layout folder, the other one for devices with 7 inch displays in sw600dp folder and one for devices with 10 inch displays in sw720dp folder. The link provided by @Susan should be helpful for you.
 
krompa
Lost but trying
Profile
Posts: 257
Reg: Jun 14, 2013
Bristol
8,820
like
10/28/13 12:57 PM (12 years ago)
Hi Susan & Sandeep Yes that was a really useful link. I wasn't aware of the scaling to ldpi (x0.75), hdpi (x1.5) and xhdpi (x2.0) - which certainly helps. Time to add a couple more xml files and do some more testing on larger devices.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.