在高分辨率设备中设计不正确

时间:2013-02-25 05:45:39

标签: android

我的设计在Android 2.1中很好,在Android 4.0正常分辨率设备中很好但是当我在平板电脑上运行我的应用程序时它的设计完全改变了,帮帮我

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/bowlbackground" >

<LinearLayout
    android:id="@+id/hkk"
    android:layout_width="match_parent"
    android:layout_height="54dp"
    android:layout_marginLeft="18dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="05dp" >

</LinearLayout>
<LinearLayout
    android:id="@+id/hll"
    android:layout_width="match_parent"
    android:layout_height="54dp"
    android:layout_marginLeft="18dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="143dp" >

</LinearLayout>

<LinearLayout
    android:id="@+id/hll2"
    android:layout_width="match_parent"
    android:layout_height="54dp"
    android:layout_marginLeft="18dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="0dp" >

      </LinearLayout>

 </LinearLayout>

2 个答案:

答案 0 :(得分:2)

  1. 设计手机和平板电脑是不同的。
  2. 避免使用固定的宽度和高度大小的视图(除非它真的 不可避免的。See this了解更多信息
  3. 请参阅supporting multiple screens的文档。它有助于设计平板电脑。

答案 1 :(得分:1)

使用此

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

res/drawable-mdpi/my_icon.png        // bitmap for medium density
res/drawable-hdpi/my_icon.png        // bitmap for high density
res/drawable-xhdpi/my_icon.png       // bitmap for extra high density