[英]How can I create a project for phones and tablets in Android Studio?
How can I create a project in Android Studio for phones and tablets, where the APK on the Play Store is the same for both?如何在 Android Studio 中为手机和平板电脑创建项目,其中 Play 商店中的 APK 对两者都相同?
I am using build variants with build flavors, but there are two APKs for every device.我正在使用具有构建风格的构建变体,但每个设备都有两个 APK。
You can just approximate if it's a tablet or not by checking the screendimension.您可以通过检查屏幕尺寸来估算它是否是平板电脑。 If the app uses XLARGE or LARGE display dimensions, it could be a tablet or a "big" phone.
如果应用程序使用 XLARGE 或 LARGE 显示尺寸,则它可能是平板电脑或“大”手机。
You can get informations about that with something like this:您可以通过以下方式获取相关信息:
if(getResources().getConfiguration().screenLayout == Configuration.SCREENLAYOUT_SIZE_LARGE
|| getResources().getConfiguration().screenLayout == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
//doSomething
}
You can test which of these ones is the better one for you.您可以测试其中哪一个更适合您。
more reference:更多参考:
Designing Android apps for tablets 为平板电脑设计 Android 应用
Different GUI on phone and tablet, but same app problem 手机和平板电脑上的 GUI 不同,但应用程序问题相同
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.