2012-01-26 2 views
0

Когда я запускаю свое приложение на эмуляторе планшета, он показывает разные цвета. Смотрите это изображение (я разрезал правую сторону изображения, так это показывает только часть его)Тот же макет производит разный цвет на планшете

enter image description here

И это из стандартного смартфона эмулятора:

enter image description here

Так вы видите, что есть странная разница. Однако код тот же. Вот мой макет 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> 

Любые идеи, что может быть неправильным или как это исправить?

+1

Это не ошибка, а намерение. Android использует стиль по умолчанию для версии device/android. Стиль по умолчанию для планшетов отличается от стиля на смартфонах. Так как это хорошая идея придерживаться стилей по умолчанию с вашим приложением, это поведение вы видите, что все в порядке. –

+0

спасибо, вы можете сделать это, если хотите. –

ответ

2

Это не ошибка, а намерение. Android использует стиль по умолчанию для версии device/android. Стиль по умолчанию для планшетов отличается от стиля на смартфонах. Так как это хорошая идея придерживаться стилей по умолчанию с вашим приложением, это поведение вы видите, что все в порядке.

Смежные вопросы