Skip to content Skip to sidebar Skip to footer

Different Layouts According To Screen Resolution -android

I am trying to use different layouts for different screen resolution and I have successfully done it. My problem is, I need only Landscape orientation for Large and Xlarge Layouts

Solution 1:

you need to call this in your Activity's onCreate Method:

if ((this.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)  <= Configuration.SCREENLAYOUT_SIZE_NORMAL) {
            this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

Post a Comment for "Different Layouts According To Screen Resolution -android"