DarkLeafyGreen
DarkLeafyGreen

Reputation: 70416

Same layout produces different color on tablet

when I launch my app on tablet emulator it shows different colors. See this image (I have cut the right side of the image so it shows just a part of it)

enter image description here

And this is from the standart smartphone emulator:

enter image description here

So you see that there is a strange difference. However the code is the same. Here is my layout xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res/com.markupartist.android.actionbar.example"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <com.markupartist.android.widget.ActionBar
        android:id="@+id/actionbar"
        style="@style/ActionBar"
        app:title="@string/some_title" />

    <RelativeLayout
        xmlns:a="http://schemas.android.com/apk/res/android"
        a:layout_width="fill_parent"
        a:layout_height="fill_parent"
        a:background="#ffffff" >

        <LinearLayout
            a:layout_width="fill_parent"
            a:layout_height="wrap_content"
            a:orientation="horizontal"
            a:paddingBottom="5dip"
            a:paddingLeft="5dip"
            a:paddingRight="5dip"
            a:paddingTop="5dip" >

            <MultiAutoCompleteTextView
                a:id="@+id/recipientBody"
                a:layout_width="0dip"
                a:layout_height="wrap_content"
                a:layout_weight="1.0"
                a:hint="@string/sms_to_whom"
                a:maxLines="10"
                a:nextFocusRight="@+id/smsRecipientButton" />

            <LinearLayout
                a:layout_width="wrap_content"
                a:layout_height="fill_parent"
                a:orientation="vertical" >

                <Button
                    a:id="@+id/smsRecipientButton"
                    a:layout_width="wrap_content"
                    a:layout_height="0dip"
                    a:layout_marginLeft="5dip"
                    a:layout_weight="1.0"
                    a:enabled="true"
                    a:nextFocusLeft="@+id/recipientBody"
                    a:onClick="onPickContact"
                    a:text="@string/sms_contacts" />
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
            a:layout_width="wrap_content"
            a:layout_height="fill_parent"
            a:layout_marginRight="10dip"
            a:layout_marginBottom="10dip"
            a:gravity="bottom"
            a:orientation="vertical" 
            a:layout_above="@+id/bottomLayer" a:layout_alignParentRight="true">

            <TextView
                android:id="@+id/chars"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:text="" />
        </LinearLayout>

        <LinearLayout
            a:id="@+id/bottomLayer"
            a:layout_width="fill_parent"
            a:layout_height="wrap_content"
            a:layout_alignParentBottom="true"
            a:background="#9c9e9c"
            a:orientation="horizontal"
            a:paddingBottom="5dip"
            a:paddingLeft="5dip"
            a:paddingRight="5dip"
            a:paddingTop="5dip" >

            <EditText
                a:id="@+id/smsBody"
                a:layout_width="0dip"
                a:layout_height="wrap_content"
                a:layout_weight="1.0"
                a:autoText="true"
                a:capitalize="sentences"
                a:hint="@string/sms_enter_message"
                a:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
                a:nextFocusRight="@+id/send_button"
                a:minLines="5"
                a:gravity="left|top"/>

            <LinearLayout
                a:layout_width="wrap_content"
                a:layout_height="fill_parent"
                a:orientation="vertical" >

                <Button
                    a:id="@+id/smsSendButton"
                    a:layout_width="wrap_content"
                    a:layout_height="0dip"
                    a:layout_marginLeft="5dip"
                    a:layout_weight="1.0"
                    a:enabled="false"
                    a:nextFocusLeft="@+id/smsBody"
                    a:text="@string/sms_send_abbr" />
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>
</LinearLayout>

Any ideas what might be wrong or how to fix it?

Upvotes: 0

Views: 296

Answers (1)

js-
js-

Reputation: 1632

It is not wrong but intended. Android uses the default style of the device / android version. The default style for tablets is different to those on smartphones. Since it is a good idea to stick to the default styles with your app this behaviour you see there is just right.

Upvotes: 2

Related Questions