Layout
은 전화기에서 예상대로 표시되며 에뮬레이터에서 다르게 보입니다. SDK API 10 (Android 2.3)을 사용하고 있습니다. 테스트 폰은 Android 2.3.3 (Cyanogen Mod 7)이 장착 된 Motorola Milestone입니다.에뮬레이터와 휴대 전화에서 다르게 보이는 AppWidget
SDK 레이아웃 미리보기는 에뮬레이터와 같은 미리보기를 렌더링합니다.
다음 이미지는 예상되는 오른쪽 렌더링 (전화로 렌더링)과 예상치 못한 렌더링 (SDK API 10, 에뮬레이터 및 미리보기)을 보여줍니다.
무엇의 차이에 대한 이유는 무엇이며 어떻게 해결합니까? 여백 및 패딩 제거 (0dp로 설정하여 TextView1
) 도움이되지 않았습니다.
기본 레이아웃 (상위)
<?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"
android:background="@drawable/test_bg_red"
android:padding="20dp"
>
<include
android:layout_width="fill_parent"
android:layout_height="26dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
layout="@layout/test_child" />
/>
<include
android:layout_width="fill_parent"
android:layout_height="26dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
layout="@layout/test_child" />
</RelativeLayout>
하위 레이아웃 I이 상이한 종횡비를 갖는 다른 스크린에 의한 것으로 판단
<?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="26dp" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="4dp"
android:gravity="top"
android:includeFontPadding="false"
android:text="42"
android:textSize="32dp"
android:textStyle="bold" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView1"
android:layout_toRightOf="@+id/textView1"
android:includeFontPadding="false"
android:text="TextView2"
android:textSize="12dp" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_alignParentTop="true"
android:includeFontPadding="false"
android:text="TextView3"
android:textSize="10dp" />
</RelativeLayout>