1

I have a piece of layout code as below

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:padding="2dp"
        android:weightSum="2">

        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="Text"
            android:textSize="18sp"
            android:textStyle="normal" />

        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="Button"
            android:textSize="18sp"
            android:textStyle="normal" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:padding="2dp"
        android:weightSum="2">
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="10dp"
            android:background="@android:color/darker_gray" />

        <Button
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="10dp" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:padding="2dp"
        android:weightSum="2">
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="20dp"
            android:background="@android:color/darker_gray" />

        <Button
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="20dp" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:padding="2dp"
        android:weightSum="2">
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="30dp"
            android:background="@android:color/darker_gray" />

        <Button
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="30dp" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:padding="2dp"
        android:weightSum="2">
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="40dp"
            android:background="@android:color/darker_gray" />

        <Button
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="40dp" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:padding="2dp"
        android:weightSum="2">
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="50dp"
            android:background="@android:color/darker_gray" />

        <Button
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="50dp" />

    </LinearLayout>

</LinearLayout>

When compiled and launched on different devices, across various Samsung, and Nexus on Lolipop and above, including Nexus 6P that is XXXHDPI density. All look the same, except for Samsung S7 (refers to the Button, they have different Padding from the others. TextView is okay).

enter image description here

So I need a special handling for Samsung S7, on setting it's dimen. Initially I thought I could use the XXXHDPI, but then it turn out Nexus 6P is not as what Samsung display.

How could I tackle my dimen to target specifically for Samsung S7?

Elye
  • 53,639
  • 54
  • 212
  • 474
  • Possible duplicate of http://stackoverflow.com/questions/16706076/drawable-folder-for-different-resolution-and-application-icon-size – Jay Rathod May 16 '16 at 09:44
  • I can't use xxxhdpi as that applies to Samsung S7 and Nexus 6. In http://stackoverflow.com/questions/16706076/drawable-folder-for-different-resolution-and-application-icon-size, there's no indication which category S7 falls into that differs from Nexus 6 :( – Elye May 16 '16 at 09:57

0 Answers0