简体   繁体   English

将Android应用扩展到不同的屏幕尺寸

[英]Scaling android app to different screen sizes

So I'm working on scaling my application to different screen sizes. 所以我正在努力将我的应用程序扩展到不同的屏幕尺寸。 Right now Its optimized for a 10.1 inch screen but I'm working to get it to run on the kindle fire which has a 7 inch screen. 现在它针对10.1英寸屏幕进行了优化,但我正努力让它在具有7英寸屏幕的点燃火上运行。 I'm only using relative layouts. 我只使用相对布局。 As of now my background scales perfectly but the image buttons ontop of the background don't scale and I was wondering if there was a reason for this. 截至目前我的背景完美地缩放,但背景上的图像按钮不能缩放,我想知道是否有这样的原因。 Also I use margins to adjust the positions of my buttons, is this okay for scaling sizes? 我也使用边距调整我的按钮的位置,这是否适合缩放尺寸?

to support application on different screen refer the following link 在不同的屏幕上支持应用程序请参考以下链接

http://developer.android.com/guide/practices/screens_support.html http://developer.android.com/guide/practices/screens_support.html

and to scale image button use nine patch images they scale well. 并缩放图像按钮使用九个补丁图像,它们可以很好地缩放。

Also I use margins to adjust the positions of my buttons, is this okay for scaling sizes? 我也使用边距调整我的按钮的位置,这是否适合缩放尺寸?

yes it okay. 是的没关系。

You should always define in your manifest because the default values can change from one version to another. 您应该始终在清单中定义,因为默认值可以从一个版本更改为另一个版本。

But if you want to support xlarge screens then you're stuck because this attribute was introduced in API level 9 (android 2.3). 但是如果你想支持xlarge屏幕,那么你就会被卡住,因为这个属性是在API级别9(android 2.3)中引入的。 You have to create two different APKs, one for android versions >= 2.3 and the other for the older ones. 你必须创建两个不同的APK,一个用于Android版本> = 2.3,另一个用于旧版本。

Since it's a common issue, android provides a nice way to publish only one application on the market even if you use multiple APKs. 由于这是一个常见的问题,即使您使用多个APK,Android也提供了一种在市场上只发布一个应用程序的好方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM