I am developing an android app for tablet and phone. So to achieve that I created two folders on for phone(layout
) and one for tablet layouts(layout-sw600dp
).
As per my previous questions comment I assumed that only tablets would pick up layouts from layout-sw600dp
. But it does not seem to work.
For nexus 4, nexus 5, nexus 6, nexus 7
devices it is taking layout-sw600dp
layout.
What am I missing here? How do I calculate phone/tablet size to proper DP
layouts?
Required designs for tablet and phone:
Another retirement to use two separate layouts:
Phone design:
Tab design:
In response to the answered post belowanswer, I have a linear layout like this:
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayouttest">
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_gravity="center_horizontal"
android:textColor="@color/black"
android:gravity="left"
android:text="LabelFirstName"
android:layout_marginTop="@dimen/_8sdp"
android:textSize="@dimen/_13sdp"
android:id="@+id/firstNameLabel"
android:layout_marginLeft="@dimen/_15sdp"
android:layout_marginRight="@dimen/_15sdp" />
<EditText
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/firstName"
android:layout_marginTop="@dimen/_3sdp"
android:background="@drawable/edt_bg"
android:textColor="@color/black"
android:layout_marginRight="@dimen/_15sdp"
android:layout_marginLeft="@dimen/_15sdp"
android:padding="@dimen/_5sdp"
android:textSize="@dimen/_14sdp"
android:textColorHint="@color/textColor" />
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_gravity="center_horizontal"
android:textColor="@color/black"
android:gravity="left"
android:text="LabelLastName"
android:layout_marginTop="@dimen/_3sdp"
android:textSize="@dimen/_13sdp"
android:id="@+id/lastNameLabel"
android:layout_marginLeft="@dimen/_15sdp"
android:layout_marginRight="@dimen/_15sdp" />
<EditText
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/lastName"
android:layout_marginTop="@dimen/_3sdp"
android:background="@drawable/edt_bg"
android:textColor="@color/black"
android:layout_marginRight="@dimen/_15sdp"
android:layout_marginLeft="@dimen/_15sdp"
android:padding="@dimen/_5sdp"
android:textSize="@dimen/_14sdp"
android:textColorHint="@color/textColor" />
</LinearLayout>
When I change the orientation the textviews are not visible. Any solution to this?