androidandroid-resourcestabletandroid-screen-support

android - tablet not using values-sw600dp and layout-sw600dp folders


I have an app which I have a layout for tablet, and its different from the phone layout.

I have my home.xml in both the layout and the layout-sw600dp, and also I have a file named screen.xml with a boolean value indicating if the device is a phone or a tablet.

/res/values-sw600dp/screen.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <bool name="isTablet">true</bool>
</resources>

/res/values/screen.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <bool name="isTablet">false</bool>
</resources>

Now I am running the app on a tablet (model: alcatel i213 tablet) and the tablet is using the default values and layout folders.

What is the problem?


Solution

  • Assuming that you are referring to this device, there may be no problem. That device probably does not have a smallest width bigger than 600dp. I would expect that its smallest width would be about 540dp, given its screen resolution (540px x 960px) and density (~157 dpi, which should map to mdpi, where 1px=1dp).