If I understood correctly, I have one layout file for xlarge and sw-600dp, and another for the rest. In any case, this was my situation when I came across this question.
This can be solved by creating layouts of the folders-xlarge and layout-s600dp and placing one layout file in them, but with the same contents. But for obvious reasons, I would like you to not have two identical files in two folders.
This is my solution to the problem. Do not create layout-xlarge and layout-sw600dp files. Let's say you create a cool job with the layout file / res / layout / cool _activity.xml. Create a tablet layout file in the same folder, but with a different name, i.e. / res / layout / cool _activity_for_tablet.xml, and then create the folder values ββ- xlarge and values-sw600dp with the layout.xml files in it with the following contents
<?xml version="1.0" encoding="utf-8"?> <resources> <item name="cool_activity" type="layout">@layout/cool_activity_for_tablet</item> </resources>
Yes, you will still have 2 of them with the same content, but this is silly content, not the layout itself, which can be hundreds of xml lines.
source share