I need to provide the same layout.xml file for an Activity for several different qualifiers. I know that there\'s a way to just reference one existing layout.xml instead of
If I understood correctly asker has one layout file for xlarge and sw-600dp and another one for all the rest. Anyway that was my situation when I stumbled on this question.
One can solve this by creating folders layout-xlarge and layout-s600dp and put one layout file in each but with the same contents. But one would like not to have two exact same files in two folders for obvious reasons.
This is my solution for the problem. Dont make layout-xlarge and layout-sw600dp files at all. Let's say you're creating a cool activity with layout file /res/layout/cool_activity.xml. Create your tablet layout file in the same folder but with a different name, i.e. /res/layout/cool_activity_for_tablet.xml and then create folders values-xlarge and values-sw600dp with layout.xml files in it with the following content
- @layout/cool_activity_for_tablet
Yes you will still have 2 of these with the same content but this is dumb content not the layout itself which can be hundreds of lines of xml.