Android 应用程序适合多种屏幕尺寸。但据我所知

Android 应用程序适合多种屏幕尺寸。但据我所知,android,Android,我已将我的应用程序发布到play store。适合SGSII Epic 4.5、LG Optimus V3.2、LG Optimus Black 4.0、Evo shift 3.6 mytouch 4g 3.8,但不适合droid bionic 4.3。有人知道为什么它不适合屏幕吗?屏幕大小为4.3,但在4.3屏幕上,该应用程序只占3.6屏幕的空间。另外,当三星向侧面倾斜时,它会尝试进入横向模式,我在清单中将其设置为android:screenOrientation=纵向 这是我的主要xml a

我已将我的应用程序发布到play store。适合SGSII Epic 4.5、LG Optimus V3.2、LG Optimus Black 4.0、Evo shift 3.6 mytouch 4g 3.8,但不适合droid bionic 4.3。有人知道为什么它不适合屏幕吗?屏幕大小为4.3,但在4.3屏幕上,该应用程序只占3.6屏幕的空间。另外,当三星向侧面倾斜时,它会尝试进入横向模式,我在清单中将其设置为android:screenOrientation=纵向

这是我的主要xml

android:layout_width="320dp"

android:layout_height="485dp"

android:orientation="vertical"

android:padding="15dp"

android:background="@drawable/graybkg"



 >

<Button
    android:id="@+id/national"

    android:layout_width="300dp"

    android:layout_height="120dp"

    android:layout_gravity="center"

    android:background="@drawable/custtomnatbut"

     />



<Button
    android:id="@+id/yorgeys"

    android:layout_width="300dp"

    android:layout_height="120dp"

    android:layout_gravity="center"

    android:background="@drawable/custtomyorgeys"

    />

您真的不应该将屏幕视为物理屏幕大小。对于布局而言,重要的是屏幕上dp单元的数量

我相信机器人仿生是一个qHD 960x540屏幕,在hdpi上运行。就dp装置而言,这是640x360dp。将其与533x320dp的典型HVGA 800x480 hdpi进行比较

您显示的布局似乎是使用插入的绝对大小编写的。如果这就是你正在做的,你就注定要失败。你不能写得好像只有一个真正的屏幕大小来控制它们。您编写布局的原因是描述您的UI,以便平台可以移动其元素以适应屏幕。试图强迫它成为一个固定的定位系统将导致你与该系统发生冲突,并最终被埋没在试图支持屏幕大小的另一种变化中


考虑到Galaxy Nexus和其他新推出的手机都是1280x800 xhdpi屏幕,这给了你另一个尺寸——640x400dp。

解决方案是什么。这是我在学习上遇到的一个问题。是否最好使用填充父项、匹配父项、换行内容?我不知道该怎么办?我才刚开始…你可以从这里开始了解基本知识:
    android:layout_width="300dp"

    android:layout_height="60dp"

    android:layout_gravity="center"

    android:background="@drawable/custtomfoursq"

    />




<LinearLayout 
    android:layout_width="300dp"

    android:layout_height="60dp"

    android:layout_gravity="center"
    >


<Button
    android:id="@+id/facebook"

    android:layout_width="150dp"

    android:layout_height="60dp"

    android:background="@drawable/custtomface"

    />



<Button

    android:id="@+id/website"

    android:layout_width="150dp"

    android:layout_height="60dp"

    android:background="@drawable/custtom_web"

     />
</LinearLayout>