[英]App fits multiple screen sizes. but one that I know of
I published my app to the play store. 我已将我的应用发布到Play商店。 Fits SGSII Epic 4.5", LG Optimus V 3.2", LG Optimus Black 4.0", Evo shift 3.6" mytouch 4g 3.8", but it doesn't fit droid bionic 4.3".
适合SGSII Epic 4.5英寸,LG Optimus V 3.2英寸,LG Optimus Black 4.0英寸,Evo shift 3.6英寸mytouch 4g 3.8英寸,但不适合droidbionic 4.3英寸。 Anybody know why it doesn't fit to the screen?
有人知道为什么它不适合屏幕吗? The screen size is 4.3" but the app only takes up room for a 3.6" screen on the 4.3" screen. Also samsung infuse 4g when tilted to the side it try's to going into landscape mode, and i have it set to android:screenOrientation="portrait" in the manifest
屏幕尺寸为4.3英寸,但该应用程序仅占用4.3英寸屏幕上3.6英寸屏幕的空间。当向侧面倾斜时,三星会注入4g并尝试进入横向模式,并且我将其设置为android:screenOrientation清单中的=“ portrait”
This is my main xml 这是我的主要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"
/>
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>
You should really not be thinking about screens as physical screen sizes. 您实际上不应该将屏幕视为物理屏幕尺寸。 What matters for layout is the number of dp units on the screen.
布局重要的是屏幕上的dp单位数。
I believe the Droid Bionic is a qHD (960x540) screen running at hdpi. 我相信Droid Bionic是可在hdpi下运行的qHD(960x540)屏幕。 In terms of dp units, this is 640x360dp.
就dp单位而言,这是640x360dp。 Compare this to the typical HVGA (800x480) hdpi which is 533x320dp.
将此与典型的HVGA(800x480)hdpi(533x320dp)进行比较。
The layouts you have shown seem to be written with absolute sizes plugged in for everything. 您显示的布局似乎是在插入绝对尺寸的情况下编写的。 If this is what you are doing, you are doomed.
如果这就是您正在做的事情,那么您注定要失败。 You can't write like there is One True Screen Size To Rule Them All.
您无法像所有人一样用一个真正的屏幕尺寸来书写。 The reason you are writing layouts is to describe your UI so the platform can move its elements around to fit to the screen.
您编写布局的原因是为了描述您的UI,以便平台可以随意移动其元素以适合屏幕。 Trying to force this into being a fixed positioning system is going to result you fighting with the system, and ultimately being buried in trying to support another and yet another variation in screen size.
试图迫使它成为固定的定位系统将导致您与该系统发生冲突,并最终陷入了试图支持屏幕尺寸的另一种变化的困境中。
Consider that the Galaxy Nexus and other newer phones coming out are 1280x800 xhdpi screens, which gives you yet another size -- 640x400dp. 考虑到Galaxy Nexus和其他较新的手机都是1280x800 xhdpi的屏幕,因此您可以再设置640x400dp的尺寸。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.