2012-01-03 82 views
1

我在我的应用程序的某个活动中运行了几个图像浏览和一个listview。显示器在模拟器中看起来很完美,它基本上显示了一个简短的字符串,顶部有两个小图像,然后是由listview组成的屏幕的其余部分,但是当我将它放在我的设备(EVO3D)上时,listview被截断。实际上宽度甚至看起来略微偏离。Android应用程序的高度/宽度在模拟器中不同于设备

这里是layout.xml文件;

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

<TextView android:text="@string/showRunList_name" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:id="@+id/editText1"> 
</TextView> 

<ImageView android:contentDescription="@string/auxLogo" 
android:id="@+id/imageView1" 
android:layout_height="wrap_content" 
android:src="@drawable/logo_small" 
android:layout_width="wrap_content" 
android:layout_gravity="center"> 
</ImageView> 

<ImageView android:contentDescription="@string/auxPhone" 
android:id="@+id/imageView2" android:layout_height="wrap_content" 
android:src="@drawable/phone" android:layout_width="wrap_content"> 
</ImageView> 

<TextView 
android:id="@+id/android:empty" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:text="@string/main_no_items"/> 

<ListView 
android:id="@+id/android:list" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:gravity="bottom|right" 
/> 
</LinearLayout> 

回答

0

检查这个http://developer.android.com/guide/practices/screens_support.html

创建具有相同的分辨率为您的设备模拟器和测试。

+0

谢谢,我今天看了这篇文章。我还创建了一个540x960 @ 256dpi的模拟器。我已经能够在这个新的AVD中复制这个问题,并且努力尝试让它以我想要的方式显示。值得一提的是,我的主要活动不仅仅是我上面列出的那个。 – Shawn 2012-01-04 01:21:47

+0

好的,我明白了我的定义。我的清单文件中的SDK; 感谢您的协助! – Shawn 2012-01-04 01:42:42

0

如果您想支持多屏幕,您需要将多屏幕支持属性添加到配置文件中,并根据标准创建不同的图像。看一看here

0

模拟器的分辨率/方面与设备不同。 EVO3D的分辨率为540x960。您的仿真器可能是HVGA(320x480)或WVGA(480x800)。这种轻微的变化会导致布局的可见部分发生一些变化。

请记住,您的应用程序在市场上会遇到更多的设备分辨率/宽高比差异,因此它应该对这些更改做出适当的反应。

HTH

1

让我列出几点需要照顾过:

  1. 您需要阅读这篇文章:Supporting Multiple Screens
  2. 正如您所描述的,图像视图位于顶部,其余部分由ListView覆盖,但是您已在父级中定义了android:layout_height =“wrap_content”,而应该是android:layout_height =“fill_parent”它将具有全屏幕高度。
  3. 要使ListView覆盖屏幕的其余部分,请定义android:layout_height="match_parent"android:layout_weight="1"
  4. 使用dpdip代替固定尺寸PX的用于定义像高度/宽度测量。
  5. 使用sp(定标点),同时定义字体大小。
+0

谢谢,我试过了,它仍然在我的设备上显示相同的方式。我创建了多个仿真器,它们看起来很好,但我的设备似乎正在切断页面的整个底部1/3。在我的其他活动中也是如此。 – Shawn 2012-01-04 01:15:51

+0

给我一个布局的粗略草图。 – 2012-01-04 05:49:30

相关问题