Reputation: 1
I have old nexus 7 2012 and now i have new one also. but same application behaves differently in both devices. as new nexus is having different resolution so i am not getting why dynamic imageview and dynamic text are behaving different. image size is getting smaller and text size is increased from 11 to 18 in new nexus. i have tried with layout-large-xhdpi and values-large-xhdpi but it is still behaving same. please help and suggest what should i do so same application can run in new nexus also perfectly.
Upvotes: 0
Views: 602
Reputation: 5260
// Figure out what kind of display we have
int screenLayout = getResources().getConfiguration().screenLayout;
if ((screenLayout & Configuration.SCREENLAYOUT_SIZE_SMALL) == Configuration.SCREENLAYOUT_SIZE_SMALL)
LogMessage("Main onCreate", "Info", "Screen size is Small");
else if ((screenLayout & Configuration.SCREENLAYOUT_SIZE_NORMAL) == Configuration.SCREENLAYOUT_SIZE_NORMAL)
LogMessage("Main onCreate", "Info", "Screen size is Normal");
else if ((screenLayout & Configuration.SCREENLAYOUT_SIZE_LARGE) == Configuration.SCREENLAYOUT_SIZE_LARGE)
LogMessage("Main onCreate", "Info", "Screen size is Large");
if ((screenLayout & Configuration.SCREENLAYOUT_LONG_YES) == Configuration.SCREENLAYOUT_LONG_YES)
LogMessage("Main onCreate", "Info", "Screen size is Long");
// Get the metrics
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int heightPixels = metrics.heightPixels;
int widthPixels = metrics.widthPixels;
int densityDpi = metrics.densityDpi;
float density = metrics.density;
float scaledDensity = metrics.scaledDensity;
float xdpi = metrics.xdpi;
float ydpi = metrics.ydpi;
LogMessage("Main onCreate", "Info", "Screen W x H pixels: " + widthPixels + " x " + heightPixels);
LogMessage("Main onCreate", "Info", "Screen X x Y dpi: " + xdpi + " x " + ydpi);
LogMessage("Main onCreate", "Info", "density = " + density + " scaledDensity = " + scaledDensity +
" densityDpi = " + densityDpi);
***please have these lines in yours manifest***
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"
/>
Upvotes: 0
Reputation: 3322
for drawables drawable-large-xhdpi
for layouts layout-large
for values values-large
Upvotes: 1