Android 手机和平板电脑用户界面

标签 android layout user-interface

我制作了一款适用于平板电脑和手机的应用程序。但正如我们所知,我们应该为平板电脑提供不同的布局(例如更大的字体和图像等)。

我的问题是如何提供布局,以便它们仅由平板电脑而非手机选择。

示例:如果我提供 xhdpi 或 hdpi 布局,将它们视为平板电脑,那么它可能会被使用相同配置的某些设备选择。

那么如何确定当前设备是平板电脑还是手机并为其提供特定的布局呢?

最佳答案

My question is how to provide the layouts such that they are only picked by tablets and not phones.

要么使用经典的屏幕尺寸桶(例如,res/layout-large/),要么使用-swNNNdp(例如,)想出你自己的桶res/layout-sw600dp/ 用于在最短宽度为 600dp 或更高的设备上使用的资源。

文档中对此进行了解释 here , here , here ,也许还有其他一些地方。

Example: If i provide xhdpi or hdpi layout thinking of these as tablet then it may be picked by some device also which is using this same configuration.

-xhdpi-hdpi 是屏幕密度,与屏幕尺寸没有直接关系。

关于Android 手机和平板电脑用户界面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15590815/

相关文章:

xaml - 如何在 XAML 中创建主布局模板

c# - 特定 WInForm 的缩放错误

css - 位置 : absolute pushes content to right in Opera/FF/IE but not with Webkit browsers

java - 依赖注入(inject)只针对服务类型对象和单例吗? (而不是图形用户界面?)

java - 我可以使用什么来代替 JPanel 中的按钮来在所有操作系统中获得相同的外观?

android - 获取 W/ClassMapper : No setter/field for XXX found on class

java - datepicker android - 构建错误

java - JSON 解析器错误

Android Gradle : Dynamically change versionName at build time

javascript - 以用户体验为中心的 Web 应用程序回归测试的工具和技术?