gpt4 book ai didi

android - Android 中的

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:31:52 24 4
gpt4 key购买 nike

美好的一天,我正在尝试将屏幕尺寸限制为仅适用于 Google Play 中的手机(即不是平板电脑)。在我找到这个 article 之后我将此添加到我的 list 文件中:

<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" />
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
</compatible-screens>

但是现在5.5++英寸手机的用户似乎无法安装我的应用程序。接下来我也找到了这个article和里面的图片:

enter image description here

我的第一个问题 - 是否可以通过特定的英寸值来限制屏幕尺寸,或者我只能使用小、普通、大和超大等标签?

在某些时候,我决定通过像这样更新 list 来将支持的英寸大小增加到 7:

<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" />
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
<!-- all large size screens -->
<screen android:screenSize="large" android:screenDensity="ldpi" />
<screen android:screenSize="large" android:screenDensity="mdpi" />
<screen android:screenSize="large" android:screenDensity="hdpi" />
<screen android:screenSize="large" android:screenDensity="xhdpi" />
</compatible-screens>

但是5.5寸甚至5.2寸的用户还是无法安装app。

那么我的第二个问题 - 我做错了什么或不明白?

老实说,我阅读了所有关于 stackoverflow 的类似问题和 android 文档中的文章,但没有找到正确的答案。谢谢。

最佳答案

编辑(2016-12-21)

在 Bryan 建议使用构建工具 25.0.1 之后,我的解决方案不再出现构建错误:

<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<screen android:screenSize="small" android:screenDensity="xxhdpi" />
<screen android:screenSize="small" android:screenDensity="xxxhdpi" />
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" />
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
<screen android:screenSize="normal" android:screenDensity="xxhdpi" />
<screen android:screenSize="normal" android:screenDensity="xxxhdpi" />

但是...在新版本中,一些设备没有出现在支持的设备列表中(Google Play 控制台):Google Pixel、Nexus 5x、Google Pixel XL、Nexus 6、Nexus 6P。

这就是为什么我的新解决方案看起来像这样:

<!-- just handsets allowed-->
<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" /> <!-- 120 -->
<screen android:screenSize="small" android:screenDensity="mdpi" /> <!-- 160 -->
<screen android:screenSize="small" android:screenDensity="hdpi" /> <!-- 240 -->
<screen android:screenSize="small" android:screenDensity="280" /> <!-- Workaround -->
<screen android:screenSize="small" android:screenDensity="xhdpi" /> <!-- 320 -->
<screen android:screenSize="small" android:screenDensity="360" /> <!-- Workaround -->
<screen android:screenSize="small" android:screenDensity="420" /> <!-- Workaround Google Pixel, Nexus 5x -->
<screen android:screenSize="small" android:screenDensity="xxhdpi" /> <!-- 480 -->
<screen android:screenSize="small" android:screenDensity="560" /> <!-- Workaround Google Pixel XL, Nexus 6, Nexus 6P -->
<screen android:screenSize="small" android:screenDensity="xxxhdpi" /> <!-- 640 -->
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" /> <!-- 120 -->
<screen android:screenSize="normal" android:screenDensity="mdpi" /> <!-- 160 -->
<screen android:screenSize="normal" android:screenDensity="hdpi" /> <!-- 240 -->
<screen android:screenSize="normal" android:screenDensity="280" /> <!-- Workaround -->
<screen android:screenSize="normal" android:screenDensity="xhdpi" /> <!-- 320 -->
<screen android:screenSize="normal" android:screenDensity="360" /> <!-- Workaround -->
<screen android:screenSize="normal" android:screenDensity="420" /> <!-- Workaround Google Pixel, Nexus 5x -->
<screen android:screenSize="normal" android:screenDensity="xxhdpi" /> <!-- 480 -->
<screen android:screenSize="normal" android:screenDensity="560" /> <!-- Workaround Google Pixel XL, Nexus 6, Nexus 6P -->
<screen android:screenSize="normal" android:screenDensity="xxxhdpi" /> <!-- 640 -->
</compatible-screens>

旧:

根据 Bryan 的回答,我的 list fragment 如下所示:

 <!-- just handsets allowed-->
<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" /> <!-- approximately 120 dpi -->
<screen android:screenSize="small" android:screenDensity="mdpi" /> <!-- approximately 160 dpi -->
<screen android:screenSize="small" android:screenDensity="hdpi" /> <!-- approximately 240 dpi -->
<screen android:screenSize="small" android:screenDensity="280" /> <!-- Workaround -->
<screen android:screenSize="small" android:screenDensity="xhdpi"/> <!-- approximately 320 dpi -->
<screen android:screenSize="small" android:screenDensity="360" /> <!-- Workaround -->
<screen android:screenSize="small" android:screenDensity="420" /> <!-- Workaround -->
<screen android:screenSize="small" android:screenDensity="480" /> <!-- Workaround -->
<screen android:screenSize="small" android:screenDensity="560" /> <!-- Workaround -->
<screen android:screenSize="small" android:screenDensity="640" /> <!-- Workaround -->
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" /> <!-- approximately 120 dpi -->
<screen android:screenSize="normal" android:screenDensity="mdpi" /> <!-- approximately 160 dpi -->
<screen android:screenSize="normal" android:screenDensity="hdpi" /> <!-- approximately 240 dpi -->
<screen android:screenSize="normal" android:screenDensity="280" /> <!-- Workaround -->
<screen android:screenSize="normal" android:screenDensity="xhdpi"/> <!-- approximately 320 dpi -->
<screen android:screenSize="normal" android:screenDensity="360" /> <!-- Workaround -->
<screen android:screenSize="normal" android:screenDensity="420" /> <!-- Workaround -->
<screen android:screenSize="normal" android:screenDensity="480" /> <!-- Workaround -->
<screen android:screenSize="normal" android:screenDensity="560" /> <!-- Workaround -->
<screen android:screenSize="normal" android:screenDensity="640" /> <!-- Workaround -->
</compatible-screens>

无法使用 Bryan 的解决方案,因为我遇到编译错误:“AAPT:不允许字符串类型(在‘screenDensity’上值为‘xxxhdpi’)”

它适用于(较新的)设备,例如 Google Pixel (2.6 * 160 dp = 416 dp -> 420dp -> explanation: )/Pixel XL (3.5 * 160 dp = 560 dp) 或三星 Galaxy S6 (4.0 * 160) dp = 640 dp)。dp 值在此处描述:https://material.io/devices/

我认为这可行,因为我上面提到的设备出现在 Google Play 控制台的“支持的设备”列表中。

关于android - Android 中的 <compatible-screens>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39834843/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com