我有一个使用画布绘制原语加上TextView和2按钮的自定义视图中绘制图形的布局。仿真器设置为与手机相同的像素宽度(400像素),2D图形以像素尺寸指定。Android模拟器与手机不匹配
(左仿真器,手机上的权利。)
注意图形匹配。 (由于数据不同,图形的实际内容不同)但TextView和按钮完全不同。这里的XML -
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:background="#303080"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/eventSummary"
android:layout_width="250dp"
android:background="#202090"
android:layout_height="fill_parent"
android:minLines="4"
android:singleLine="false"
android:text="text" />
<Button android:id="@+id/PrevButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="prevButtonHandler"
android:text="<"
/>
<Button android:id="@+id/NextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="nextButtonHandler"
android:text=">"
/>
</LinearLayout>
...我已经试过指定使用SP的和DP的TextView的宽度。为什么有这么大的差异,我怎样才能让仿真器和手机匹配? (FWIW手机是HTC Droid Incredible)。
在此先感谢!
并非所有的仿真器都是完美的。也许把这个作为一个错误报告提交给模拟器的制造商。 – SpliFF 2011-02-13 03:47:07
这只是普通的android模拟器。此外,2D图形匹配和TextView宽度(250)在模拟器上看起来比电话更加正确。我需要明白为什么会有这么大的差异。 – 2011-02-13 04:12:31