I have some thought on how layout works in Android development.
I have written an app for a tablet with full HD resolution (10" Xperia Z1 Tablet, 1920 x 1200). The app looks good and works well on the tablet. The app is always in landscape mode.
When I install the same app on a 4.8" phone, that has half the resolution (1280 x 800), I need to specify a different layout and name the folders using the w<dp>
thing (and change the layout so it fits the phone better).
Tablet
So, for the tablet I think I should use:
layout-w1359dp-land
and the reason is this:
Dpi: 226 (http://pixeldensitycalculator.com/?h=1920&v=1200&d=10)
Width (px): 1920
Calculation: 1920 / (226/160) = 1920 / 1,4125 = 1359
Phone
And for the phone
layout-w652dp-land
and the reason is this:
Dpi: 314 (http://pixeldensitycalculator.com/?h=1280&v=800&d=4.8)
Width (px): 1280
Calculation: 1280 / (314/160) = 1280 / 1,9625= 652
The problem
It's not working. It looks as bad as it always does. It doesn't seem that it takes the layout-w652dp-land into account at all.
The images shows the problem, and I don't get why it doesn't matter what I do in the layout-w652dp-land folder.
What might be the reason why the folders are not "respected"?
TABLET VIEW (ALL OK):
** SAMSUNG S3 PHONE VIEW (before and after the folder-name-change) **
Edit
I waited with posting the XML, as I didn't want to make this post too large, and I wasn't sure it was relevant to the "overall" question, but here it is:
booking_row.xml - each row is defined by this:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#AAF0F0F0">
<!-- TODO: Update blank fragment layout -->
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center" >
<TableRow
android:id="@+id/booking_row_tablerow"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="0dp"
android:gravity="center_vertical"
android:background="@android:drawable/list_selector_background"
>
<View
android:id="@+id/booking_row_status_color"
android:layout_width="30dp"
android:background="@android:color/holo_red_dark"></View>
<View
android:id="@+id/View01"
android:layout_width="3px"
android:layout_height="fill_parent"
android:background="#22000000" />
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:layout_gravity="center" >
<TextView
android:id="@+id/booking_row_tv_time"
android:layout_width="60dp"
android:layout_height="fill_parent"
android:text="13:10"
android:textSize="10sp"
android:layout_column="3"
android:padding="5dp"
android:gravity="center"
/>
</FrameLayout>
<View
android:id="@+id/View01"
android:layout_width="0px"
android:layout_height="0dp"
android:background="#46000000" />
<View
android:id="@+id/View01"
android:layout_width="0px"
android:layout_height="0dp"
android:background="#00ffffff" />
<TextView
android:id="@+id/booking_row_tv_name"
android:layout_width="200dp"
android:text="Test test"
android:textSize="17sp"
android:layout_column="3"
android:padding="5dp" />
<View
android:id="@+id/View01"
android:layout_width="3px"
android:layout_height="fill_parent"
android:background="#22000000" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/booking_row_imageview_direction"
android:layout_column="1"
android:src="@drawable/icon_car_incoming"
android:padding="5dp"
/>
<View
android:id="@+id/View01"
android:layout_width="3px"
android:layout_height="fill_parent"
android:background="#22000000" />
<TextView
android:id="@+id/booking_row_tv_address"
android:layout_width="250dp"
android:text="Some address"
android:textSize="17sp"
android:layout_column="3"
android:padding="5dp" />
<View
android:id="@+id/View01"
android:layout_width="3px"
android:layout_height="fill_parent"
android:background="#22000000" />
<TextView
android:id="@+id/booking_row_tv_delayInfo"
android:layout_width="80dp"
android:text="Info info"
android:textSize="17sp"
android:layout_column="3"
android:padding="5dp" />
<View
android:id="@+id/View01"
android:layout_width="3px"
android:layout_height="fill_parent"
android:background="#22000000" />
<ImageView
android:layout_margin="5dp"
android:layout_width="wrap_content"
android:id="@+id/booking_row_gps_valid"
android:src="@drawable/icon_gps_valid" />
<View
android:id="@+id/View01"
android:layout_width="3px"
android:layout_height="fill_parent"
android:background="#22000000"
android:visibility="gone" />
<TextView
android:id="@+id/booking_row_tv_miscInfo"
android:layout_width="200dp"
android:text="Framplats, ENS"
android:textSize="30sp"
android:layout_column="3"
android:padding="5dp"
android:visibility="gone" />
</TableRow>
</TableLayout>
</FrameLayout>