Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Android studio diffrent screen size open diffrent layout file?

Layout XML file

activity_one – 360dp above

activity_two – 480dp above

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

activity_three -600dp above

java file diffrent size diffrent layout

     super.onCreate(savedInstanceState);

    //getSupportActionBar().hide();

    setContentView(R.layout.activity_one);

>Solution :

Maybe try It java code more than clear :-

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Configuration config = getResources().getConfiguration();
    if (config.smallestScreenWidthDp >= 320) {
        setContentView(R.layout.activity_one);
    } else if (config.smallestScreenWidthDp >= 480) {
        setContentView(R.layout.activity_two);
    } else if (config.smallestScreenWidthDp >= 600) {
        setContentView(R.layout.activity_three);
   }
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading