Set two different layout in res res/layout folder, set the the these two layout file programmatically in android.
Put these code in onCreate in you activity.
Put these code in onCreate in you activity.
Hopefully you enjoy it. Happpy Coding !
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int screen_size = (conf.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK);
if ((metrics.densityDpi == DisplayMetrics.DENSITY_LOW || metrics.densityDpi == DisplayMetrics.DENSITY_HIGH)
&& screen_size == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
setContentView(R.layout.test_hdpi);
} else {
setContentView(R.layout.test);
}
0 comments
Posts a comment