0

My app looks like crap on qHD screens, but looks perfect on all other devices Ive tried it on.

qHD device example

Galaxy Nexus

Incredible

My layout is as follows. I use dp as I was led to believe that that should be density independent, but to be honest, I'm not sure what the difference is between dip, dp, px, sp, etc. I've read the docs, they just don't make it very clear.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <RelativeLayout
        android:id="@+id/header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@drawable/dialog_full_holo_dark"
        android:orientation="horizontal" >

        <ImageView
            android:id="@+id/userP"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5dp"
            android:src="@drawable/acct_sel" />

        <TextView
            android:id="@+id/userN"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/userP"
            android:layout_toRightOf="@+id/userP"
            android:padding="5dp"
            android:text="Name"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="@color/ics" />

        <TextView
            android:id="@+id/countTotal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/userP"
            android:layout_alignParentRight="true"
            android:paddingBottom="5dp"
            android:paddingRight="5dp"
            android:text="/140"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="@color/ics" />

        <TextView
            android:id="@+id/myCount"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/userP"
            android:layout_toLeftOf="@+id/countTotal"
            android:paddingBottom="5dp"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="@color/ics" />

    </RelativeLayout>

    <EditText
        android:id="@+id/editMessage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/header"
        android:hint="Message" >
    </EditText>

    <LinearLayout
        android:id="@+id/linearLayout1"
        style="?android:attr/buttonBarStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/save_b"
            style="?android:attr/buttonBarButtonStyle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Save" />

        <Button
            android:id="@+id/cancel_b"
            style="?android:attr/buttonBarButtonStyle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Cancel" />
    </LinearLayout>

    <ImageView
        android:id="@+id/div5"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/editMessage"
        android:layout_alignParentLeft="true"
        android:paddingTop="3dp"
        android:scaleType="fitXY"
        android:src="@drawable/test" />

    <TextView
        android:id="@+id/mentionsTv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/editMessage"
        android:paddingLeft="10dp"
        android:paddingTop="3dp"
        android:text="Add Mentions"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <ImageView
        android:id="@+id/div4"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/mentionsTv"
        android:paddingTop="3dp"
        android:scaleType="fitXY"
        android:src="@drawable/test" />

    <TextView
        android:id="@+id/dayTv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/div4"
        android:paddingLeft="10dp"
        android:paddingTop="3dp"
        android:text="Day Picker"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <ImageView
        android:id="@+id/div2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/dayTv"
        android:paddingTop="3dp"
        android:scaleType="fitXY"
        android:src="@drawable/test" />

    <EditText
        android:id="@+id/editInterval"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/div2"
        android:hint="Interval (in minutes) between sends."
        android:inputType="number"
        android:paddingTop="3dp" />

    <ImageView
        android:id="@+id/div3"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/editInterval"
        android:paddingTop="3dp"
        android:scaleType="fitXY"
        android:src="@drawable/test" />

    <EditText
        android:id="@+id/editAmount"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/div3"
        android:hint="Number of sends per day."
        android:inputType="number"
        android:paddingTop="3dp" />

    <ImageView
        android:id="@+id/div1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/editAmount"
        android:paddingTop="3dp"
        android:scaleType="fitXY"
        android:src="@drawable/test" />

</RelativeLayout>

What do I need to do to make it display properly on qhd devices?

alain.janinm
  • 19,951
  • 10
  • 65
  • 112
r2DoesInc
  • 3,759
  • 3
  • 29
  • 60
  • 1
    For a details on the difference between / information about the dp, dip, sp, px, etc, refer to this link: http://stackoverflow.com/a/2025541/450534 – Siddharth Lele Apr 10 '12 at 05:40
  • OK, thats good to know, but even according to that answer, "Using sp/dp will make your Android applications compatible with multiple screen densities and resolutions". Im using dp, but its obviously not compatible. – r2DoesInc Apr 10 '12 at 05:55
  • Well, in all honesty, I never had any issues with any of my apps till date. Have you considered using LinearLayouts instead of RelativeLayouts? I ask this considering that your layout doesn't seem too complex. You can make good use of the android:layout_weight="1" parameter with LinearLayouts. That has always done the trick for me. – Siddharth Lele Apr 10 '12 at 06:11

0 Answers0