Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Screen Resolutions

I've been learning Android and Phonegap development from mainly these two sources:

http://news.softpedia.com/news/How-to-Run-Android-Applications-on-Ubuntu-115152.shtml

http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart

I have a Samsung Galaxy Tab.

What baffles me, though, are:

  1. What screen size do I use in development to reach the largest number of Android phones and tablets here in Q4 2010? Do you recommend WVGA800 for a 480x800 screen?
  2. How do most Android apps resize properly into my 7" Samsung Galaxy Tab even though it has a high resolution? What are the developers doing to achieve this? I mean, can you make your apps have a kind of stretchiness and the fonts stretch too? Or, is Google detecting the app was designed for a smaller screen and so it handles resizing for the Galaxy Tab? And do I need to change something in the AndroidManifest.xml?
  3. I used the HVGA default in the emulator, and it was zippy fast. When I switched to WVGA800, it got a lot slower. Why is that?
like image 344
Volomike Avatar asked Aug 12 '26 21:08

Volomike


1 Answers

Here are my answers entirely from an Android developer's perspective (I have no experience with PhoneGap, so I can't say how that affects things):

  1. For the majority of my testing, I focus on 320x480 and 480x800. For tablets, you're also going to want to specifically test against the Galaxy Tab (see Samsung's site for more details on testing in the emulator).

  2. Layouts in Android are generally designed (or should be) to support any screen size. Typically Views are set to MATCH_PARENT (previously FILL_PARENT) or WRAP_CONTENT, so their size depends on either what layout they are in or what content they contain rather than how large the display is. You can also specify "DP" (density-independent pixels), which will scale automatically for you (so 2dp would be 2px on an HVGA device but 3px on a WVGA device). Fonts should be specified in SP, which are essentially the same thing but also take into account the user's font preference.

    You can also apply weights for stretching Views. For example, if you have a LinearLayout with horizontal orientation, you can put two Views in it (let's say a TextView and an EditTextView). You might set both of those to WRAP_CONTENT for their width and height, but you would probably add a layout_weight="1" to the EditTextView, telling it to fill the remaining space. In addition, you can create specific layouts for large devices to customize the display for the Galaxy Tab.

  3. The higher the resolution, the more pixels the emulator is handling. You'll also notice performance difference among the versions of Android.

That being said, it looks like PhoneGap is more or less like developing a WebApp, in which case you'll find the Android Web Apps articles helpful.

Edit (responses to first comment since my formatting was getting messed up):

No, there isn't anything to change in the AndroidManifest other than specifying what you support:

<supports-screens
  android:smallScreens="true"
  android:normalScreens="true"
  android:largeScreens="true"
  android:xlargeScreens="true"
  android:anyDensity="true" />

For CSS, you can specify styles based on density or use standard percents, em measurements, etc.

like image 79
Ian G. Clifton Avatar answered Aug 15 '26 13:08

Ian G. Clifton