不同型号手机的布局 [英] Layouts on different models of mobiles

查看:113
本文介绍了不同型号手机的布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我开发的Galaxy 10.1,7寸1024×600带,480x800的一个应用程序,注意与800高度ABD S3拥有720个高度。他们都在这些分辨率运行完美。但是,当我们谈论注2和Galaxy 7加等我们得到了。其中是布局不正确看到这些设备的几个问题。在布局,IAM面临的一个问题,我使用的布局文件夹注的布局,正常xhdpi,1280×800和S3的布局,正常xhdpi,1280×720,并把所有的布局在一个文件夹令人不禁APK支持所有这些布局。

Recently i develop an app for Galaxy 10.1 ,7 inch with 1024x600 ,480x800,Note with 800 height abd S3 with 720 height. they are all running perfectly on these resolution. But when we talk about note 2 and galaxy 7 plus and other we got several issues .Which are that the layouts are not correctly seen on these devices. At that iam facing a problem in layouts i use layouts folder for note as layouts-normal-xhdpi-1280x800 and for S3 layouts-normal-xhdpi-1280x720 and put all the layouts in one folder which makes one apk supporting all these layouts.

但是,当用户下载APK他们处理的一个问题,是,Galaxy Note的采摘布局正常xhpi,1280×720的布局,这是正确的,但S3和Galaxy Note的2有不同的密度。

But when customers download the apk they deal with a problem which was that the Galaxy note picking the layout-normal-xhpi-1280x720 layouts and it was right but S3 and Galaxy Note 2 have different density .

这是问题,因为我无法弄清楚如何声明布局文件夹,S3和Note 2。 有没有,我只使用默认的四个文件夹没有办法

Because of that problem I can't figure out how to declare layout folder for S3 and Note 2. Is there any way that i use only default four folders

布局XLARGE

布局Xhdpi正常

布局MDPI

布局华电国际与正​​常

Layout hdpi with normal

和支持这些所有布局所有的屏幕像S3,注1,注2,7英寸以及和其他人。当我尝试启动我的项目,我一直以为对大著名的游戏一样,其中之一是神庙逃亡,它可以运行在所有的手机和标签。

and supports these all layouts for all screen like S3 ,note 1, note 2, 7 inch plus and others. When i try to start my project i always thought about the big famous games like one of these is "Temple Run" which runs on all mobiles and tabs.

制作一堆布局的文件夹让我的应用程序重样它跨越了80MB的限制和谷歌市场只接受小于50MB的应用程序。

Making bunch of layouts folder make my app heavy like it crosses 80MB limit and Google market only accepts less than 50MB apps.

临语法是有,我们只使用一种布局文件夹,并支持这种布局在所有屏幕上的任何方式。 我读的文章和Android开发者门户网站数量,但他们并没有满足有利的事都说你必须做出不同的布局文件夹不同的屏幕,甚至在计算器我看到了同样的情况救了我的时间,第一批项目 我使用这些技术,但是我现在的工作是与日俱增,我想,我开始用这些技术这使得因为这些一堆布局我的应用程序不重加浪费我的时间在做布局应用程序的数字编号。

Pro grammatically is there any way that we use only one layout folder and support this layout on all screens. I read number of articles and android developer portal but they did not satisfy me.They all said you have to make different layouts folder for different screens and even on stackoverflow i saw the same situation for saving my time in first projects I use these techniques but my work is now increasing day by day and i want that i start with those techniques which make my app not heavy because of these bunch of layouts plus not waste my time in making number of layouts for numbers of app.

数有助于将AP preciated,我想答案和建议,因为这些问题都面临着通过和开发商这是新的人也数。

Number of helps will be appreciated and i want answers and suggestions because these problems are faced by number of developers which are new and others also.

推荐答案

我也是在我的应用程序面临这样的问题。但我发现这样做的一个很好的解决方案。 我对和目录名是布局sw600dp 只有一个布局。 现在,当一部分来到了高度和宽度的问题,我已经创建了几个不同的目录中,我把尺寸字体大小等存根。所以就没有平板电脑屏幕中的值布局

I am also facing such problem in my application. But i found a good solution for this. I have only one layout for tablet and directory name is layout-sw600dp. Now, when part came to height and width problems, I have created several different values directory in which i place dimensions and font size and other stubs. So there will be no constant value in layout of tablet screen.

androd:layout_width:"60dp" // i drop this scenario

androd:layout_width:"@dimen/tab_width" // i used this scenario

和您的目录名会像

values-xlarge
values-large

所有的值将被从你的价值观目录中获取。它不会产生不同的布局,但一种布局可多次使用。

All the values will be fetched from your values directory. It will not create different layout, but one layout can be used multiple times.

编辑:

以下是 Developer.android 网​​站的话。 配置实例

Following are words of Developer.android site. Configuration examples

要帮助你定位你的一些设计适用于不同类型的设备,这里有一些数字为典型的屏幕宽度:

To help you target some of your designs for different types of devices, here are some numbers for typical screen widths:

320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7" tablet (600x1024 mdpi).
720dp: a 10" tablet (720x1280 mdpi, 800x1280 mdpi, etc).

使用大小预选赛从表2,您的应用程序可以在不同的布局之间的资源使用你想要的宽度和/或高度的任何数量的手机和平板电脑的切换。例如,如果600dp是平板电脑的布局所支持的最小可用宽度,可以提供这两套布局:

Using the size qualifiers from table 2, your application can switch between your different layout resources for handsets and tablets using any number you want for width and/or height. For example, if 600dp is the smallest available width supported by your tablet layout, you can provide these two sets of layouts:

RES /布局/ main_activity.xml#对于手机
RES /布局sw600dp / main_activity.xml#对于片

res/layout/main_activity.xml # For handsets
res/layout-sw600dp/main_activity.xml # For tablets

===

在此,你可以看到,布局1280 * 720下布局sw720dp 等等,而不是创造布局正常XLARGE 你应该使用这个东西,它可以让你来决定的差异。而不是确定不同的使用布局大MDPI 布局大LDPI ,are't你只是确定其最小宽度?因为,机器人提供了可绘制目录不同的图像,唯一的一点是它的分辨率。你有上面的解决方案。

In this, you can see that, layout for 1280*720 is under layout-sw720dp so instead of creating layout-normal-xlarge you should use this thing which lets you to decide differences. Instead of identify differently using layout-large-mdpi and layout-large-ldpi, are't you just identify by its smallest width? Because, android providing drawables directory for different images, only thing is its resolution. And you have above solution.

这篇关于不同型号手机的布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆