dimens.xml在7英寸值的文件夹;和10 QUOT;平板电脑,怎么样? [英] dimens.xml in values folder for 7" and 10" tablet, how to?

查看:138
本文介绍了dimens.xml在7英寸值的文件夹;和10 QUOT;平板电脑,怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾尝试与

values-mpdi, values-land-mpdi, values-hpdi and values-land-hdpi

这在手机的屏幕工作正常,问题是,它可能发生,一个7平板电脑需要从价值观MDPI的值和10平板电脑也一样,但结果是不一样的,我猜是因为屏幕大小(虽然是相同的分辨率和密度相似)
所以我尝试:

which works fine in phone's screens, the problem is that it could happen that a 7" tablet takes the value from values-mdpi and a 10" tablet too, but the result is not the same, I guess because of the screen size (although is the same resolution and similar density) so I tried:

values-sw600dp-hdpi
values-sw600dp-port-hdpi
values-sw600dp-mdpi
values-sw600dp-port-mdpi
values-sw720dp-hdpi
values-sw720dp-port-hdpi
values-sw720dp-mdpi
values-sw720dp-port-mdpi

但应用程序崩溃,因为它没有找到所需要的资源....

but the app crashes because it does not find the resource needed....

任何帮助将非常AP preciated

any help will be much appreciated

在此先感谢

推荐答案

基本上三个主要设备类别存在的Andr​​oid应用程序需要支持:

Basically three main device categories exist that Android applications need to support:

1)手机(电话)
2)小片(7类)
3)大粒(10及以上)。

1) handsets (phones) 2) small tablets (7″ category) 3) large tablets (10″ and above).

预选赛的Andr​​oid 3.2之前:

谷歌的第一个是在由设备创建的预选赛以单独的资源尝试是创建一个大小水桶一把:小,正常,大,超大。最初,这个摸索出以及手机设备是在小/正常类,第一个 7市场上的平板电脑为大,第一个 10片是XLARGE。

Google’s first attempt at creating qualifiers to separate resources by device was to create a handful of size buckets: small, normal, large, xlarge. Initially, this worked out well as handset devices were in the small/normal category, the first 7″ tablets on the market were large, and the first 10″ tablets were xlarge.

从Android 3.2开始预选赛:

然而,随着越来越多的设备开始出现在市场上的新的屏幕尺寸和行开始模糊何处设备可能present本身。 :一种新的解决问题的方法是Android 3.2的 psented $ P $,形式为新预选赛一个基于设备的电流宽度/高度或挑资源 最小的宽度;后者通过重新presenting它在宽度方面(在密度无关的像素,或DP)屏幕的最短侧的是用于该设备尺寸的新的指定。

However, as more and more devices began appearing in the market with new screen sizes and the lines began to blur about where a device might present itself. A new solution to the problem was presented in Android 3.2, in the form of new qualifiers to pick resources based on a devices current width/height or "smallest" width; the latter being a new designation for the devices size by representing it in terms of the width (in density-independent pixels, or dp) of the shortest side of the screen.

使用新的范例,它已成为常见于720dp定义小片为具有600dp的最小宽度,以及大粒,以手机为落在该线以下的一切。

Using the new paradigm, it has become common to define small tablets as having a smallest width of 600dp, and large tablets at 720dp, with handsets being everything that falls below that line.

使用预选赛时最小支持低于3.2和目标高于或等于3.2
对于应用程序指定Android 3.2或更高版本最低限度这个新系统的工作原理well.However如果开发商希望创建一个运行在手机上的通用和平板电脑被迫支持最低Android版本不超过2.2走高,涨幅在2.3最好的应用程序,然后在这种情况下与老大小限定符的目录中创建每个资源的副本,并将其放置在其他目录中有相应的最小宽度限定符。

Using qualifiers when minimum support is below 3.2 and target is higher than or equal to 3.2 For applications targeting Android 3.2 or higher as a minimum this new system works well.However if developers wishing to create an application that runs universal on handsets and tablets are compelled to support a minimum Android version no higher than 2.2, or at best 2.3, then in that case create duplicates of each resource in a directory with the old size qualifier and place it an another directory with a corresponding smallest width qualifier.

例如。保持相同的 dimens.xml 文件中的价值观大价值观sw600dp 。因此,在Android版本比3.2更低的运行设备将值从价值观大并从Android版本高于或等于3.2将值运行设备价值观sw600dp

Eg. keeping the same dimens.xml file in values-large and values-sw600dp. So the device running on android version lower than 3.2 will take values from values-large and the device running on android version higher than or equal to 3.2 will take values from values-sw600dp

这篇关于dimens.xml在7英寸值的文件夹;和10 QUOT;平板电脑,怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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