Taglayout

long or notlong

As you know you can name layout or resource folders with “-long” or “-notlong” postfix.
Documentation says:

  1. long – resources for screens of any size or density that have a significantly taller (in portrait mode) and wider (in landscape mode) aspect ratio than the baseline screen configuration.
  2. notlong – resources for use only on screens that have an aspect ratio that is similar to the baseline screen configuration.

What does it mean in practice?

hvga – notlong
qvga – notlong
wqvga400 – long
wqvga432 – long
wvga800 – long
wvga854 – long

i.e. if you have aspect ration > 1.5 like 1.78 (480×854) long folders will be used by Android.

For example if you scale layout hvga (1.5) to wvga854 (1.78) – you should take into account additional 480*1.5=720; 854-730=134 pixels in the middle.

p.s. Motorola Flipout is notlong also because it is just landscape qvga.

//DL

Android 1.6: strange things happen with UI

For some reason I had the complex layout:

<LinearLayout
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"
..
<FrameLayout
	android:layout_height="fill_parent"
	android:layout_width="fill_parent"
...
<ListView
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"

ListView scroll worked perfectly on 1.5 and 1.6. At some point of time layout was changed to:

<LinearLayout
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"
..
<FrameLayout
	android:layout_height="wrap_content"
	android:layout_weight="1"
	android:layout_width="fill_parent"
...
<ListView
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"

and performance decreased dramatically on 1.6 (looks like x10 worse)… same layout works fine on 1.5. It took me a day to find this problem out.

be careful with layouts!

ldpi/hdpi layout folders and Android 1.5

There’s a problem if you develop platform-independent solution. If you have two folders like layout-land and layout-land-ldpi – Android 1.5 takes files from layout-land-ldpi folder. To avoid this just add v4 to the folder name like layout-land-ldpi-v4.

Please make sure that you have correct versions in you AndroidManifest.xml:

<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />

© 2017 Android Tales

Theme by Anders NorenUp ↑