我知道有4個標準的屏幕尺寸爲Android:如何以編程方式檢測android屏幕大小(4種標準尺寸)?
xlarge,large, normal and small
如何知道哪些屏幕尺寸從這些4種尺寸的運行裝置?
我知道有4個標準的屏幕尺寸爲Android:如何以編程方式檢測android屏幕大小(4種標準尺寸)?
xlarge,large, normal and small
如何知道哪些屏幕尺寸從這些4種尺寸的運行裝置?
int screenSize = getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK;
switch(screenSize) {
case Configuration.SCREENLAYOUT_SIZE_LARGE:
Toast.makeText(this, "Large screen",Toast.LENGTH_LONG).show();
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
Toast.makeText(this, "Normal screen",Toast.LENGTH_LONG).show();
break;
case Configuration.SCREENLAYOUT_SIZE_SMALL:
Toast.makeText(this, "Small screen",Toast.LENGTH_LONG).show();
break;
default:
Toast.makeText(this, "Screen size is neither large, normal or small" , Toast.LENGTH_LONG).show();
}
可能幫助ühttp://stackoverflow.com/questions/14215690/support-for-different-screen-sizes-in-android?rq=1 –