Let's say that I want to build 2 different sets of tablet-only layouts. One for 600dp (7" tablet 1024x600) and one for 720dp (10" tablet 1280x720 or 1280x800)
I understand that with android 3.2 you can now specify the tablet layouts. I understand that but how to specify on Google Play that this is a tablet-only app.
There is this android:requiresSmallestWidthDp to specify the minimum smallestWidth required. Fine but later on the guide you can read
Caution: The Android system does not pay attention to this attribute, so it does not affect how your application behaves at runtime. Instead, it is used to enable filtering for your application on services such as Google Play. However, Google Play currently does not support this attribute for filtering (on Android 3.2), so you should continue using the other size attributes if your application does not support small screens.
So it's not used by the system and not used by Google Play...so basically it's useless ,right ?
"You should continue using the other size attributes if your application does not support small screens.
Ok. What other size attribute? The supports-screens one ? Xlarge : screens are at least 960dp x 720dp large : screens are at least 640dp x 480dp
The 1024x600 7" tablet is a "large" screen. So I basically have to design a layout for the 640x480 res. too because if I want my app to be available for the 2 different sizes of tablets, I have to enable large and xlarge screens.
So I guess that I could build 2 different sets of layouts like this
res/layout-sw600dp/main_activity.xml # For 7” tablets (600dp wide and bigger) res/layout-sw720dp/main_activity.xml # For 10” tablets (720dp wide and bigger)
and completely omit to specify a layout for smaller screens but then the app would crash on a smaller screen. That's a way to prevent the app from running that sure is not elegant.
Is there a way to make the app available only for the 600dp and greater screens on Google-Play? I'm quite confused. I want to make a tablet-only app that a 640x480 phone could not download on Google-Play. I guess I'm missing something very obvious.
The best way to create a responsive layout is to use ConstraintLayout as the base layout in your UI. ConstraintLayout enables you to specify the position and size of each view according to spatial relationships with other views in the layout. All the views can then move and resize together as the screen size changes.
Use “wrap_content” and “match_parent” To ensure that your layout is flexible and adapts to different screen sizes, you should use "wrap_content" and "match_parent" for the width and height of some view components.
To get your app filtered for just Tablets running ICS in Google-Play you would do this in your AndroidManifest:
<supports-screens android:largeScreens="true" android:normalScreens="false" android:requiresSmallestWidthDp="600" android:smallScreens="false" android:xlargeScreens="true" /> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14" />
To get HoneyComb Tablets aswell you simply change your minSdk
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="14" />
Therefore your now saying Gingerbread (2.3) and below can't download your app (because they are not Tablets nor designed to work on tablets even if it is hacked in).
HoneyComb Tablets (3.0) is supported (because <3.2 is ignoring the requiresSmallestWidth attribute)
There are no phones running honeycomb
ICS Tablets are supported because it does look at your smallestWidth attribute
and finally ICS phones aren't because as we say ICS uses the smallestWidth attribute
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With