How to target only tablet devices in a cordova Android app

别来无恙 提交于 2019-12-24 05:31:01

问题


I have a requirement for an Android App to be built with Cordova (a hybrid App) HTML5 and CSS, and this app needs to target all (only) tablet devices starting from 7" to the largest (I believe it's 10.1"). Could someone advice on a standard implementation on media queries setup for this requirement? I am confused with the resolution and the DPI concepts of Android, when building a hybrid app with above requirement.


回答1:


Use this configuration in Manifest to allow only Tablet devices.

<supports-screens
        android:largeScreens="true"
        android:normalScreens="false"
        android:requiresSmallestWidthDp="600"
        android:smallScreens="false"
        android:xlargeScreens="true" />



回答2:


If you are looking for media queries to target you app resolution to Tablets only, here is your solution




回答3:


Media queries have been used in RWD(responsive web design) to response to different size or breakpoints in HTML by using CSS media query tag.

If you were targeting to single break-point or sets of small screen size then you don't need to have media queries in your CSS. Or you also can use any existing framework that optimized for mobile phone screen size like Ionic or Framework 7.



来源:https://stackoverflow.com/questions/29742319/how-to-target-only-tablet-devices-in-a-cordova-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!