Is it in any way possible to make a tablet use the regular layout when there is a large one available?
So for example:
if(!user.payedForTabletApp) DO_NOT_USE_LARGE_LAYOUT();
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here is how you can approach the problem:
1) Create two layouts:
res/layout/phone.xmlandres/layout/tablet.xml2) Create layout aliases:
2.1)
res/layout/main.xml->res/layout/phone.xml2.2)
res/layout-large/main.xml->res/layout/tablet.xml2.3)
res/layout-sw600dp/main.xml->res/layout/tablet.xmlBy alias I mean something like this:
For more examples of layout aliases see this tutorial.
3) Update your
onCreate()function in activity oronCreateView()function in fragment to use appropriate layout.Here is an example for activity: