问题
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