0

I am currently using an app that just supports android phones. However, recently I decided to make a tablet version of the same. I created a folder layout-large and layout-xlarge for tablet versions, but someone mentioned that there are phones which are considered large and there are certain features in layouts that I want to keep just for the tablet and not for the phones. How do I make sure the phones are not taking in any layouts from layout-large but from my default layout folders? Is there a way to make sure only tablets take in code for layouts under large and xlarge including fablets? Also, some of my tablets are xlarge with density mdpi, but all the images in mdpi are shaped at a smaller resolution so they appear stretched on my tablet, how do I go about it? Here is the code I added to recognize tablets:

boolean tabletSize = getResources().getBoolean(R.bool.isTablet);
        if (tabletSize) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
        } else {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        }

Do I need to manipulate it somehow to work for the tablets for layout-large/xlarge folders only? any idea?

1 Answers1

1

layout-sw600dp

layout-sw600dp-land

layout-sw720dp

layout-sw720dp-land

create these folders and paste your layout files to check the problem

sw stands for smallest width, these folders will make sure when you use your app on a tablet with smallest width 600dp or 720dp they will use layouts specified in this folder only, if not avaiable in this folder than the default layout folder

Community
  • 1
  • 1
Maulik Sheth
  • 584
  • 3
  • 10
  • what about large and xlarge layouts? if I use these, my 7inch tablet takes the values from layout-sw600dp and so does 10inch tablet, so the parameteres like buttons whose attributes are set manually mess up on the 7in tablet, is there a way around this? Also, do you have any clue about the second half of my question regarding xlarge screen with mdpi density –  Oct 22 '13 at 18:24
  • Check this http://stackoverflow.com/questions/15055458/detect-7-inch-and-10-inch-tablet-programmatically you can detect the device programatically and if its 600/720 dp then you can set your button parameters as you want – Maulik Sheth Oct 23 '13 at 05:12