本文整理汇总了Java中android.content.res.Configuration.SCREENLAYOUT_SIZE_NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Java Configuration.SCREENLAYOUT_SIZE_NORMAL属性的具体用法?Java Configuration.SCREENLAYOUT_SIZE_NORMAL怎么用?Java Configuration.SCREENLAYOUT_SIZE_NORMAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.res.Configuration
的用法示例。
在下文中一共展示了Configuration.SCREENLAYOUT_SIZE_NORMAL属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getScreenType
private ScreenType getScreenType(Context context) {
int type = context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
ScreenType result;
switch (type) {
case Configuration.SCREENLAYOUT_SIZE_SMALL:
result = ScreenType.SMALL;
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
result = ScreenType.NORMAL;
break;
case Configuration.SCREENLAYOUT_SIZE_LARGE:
result = ScreenType.LARGE;
break;
default:
result = ScreenType.NORMAL;
break;
}
return result;
}
示例2: checkScreenSize
public void checkScreenSize() {
int screenSize = getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK;
switch (screenSize) {
case Configuration.SCREENLAYOUT_SIZE_XLARGE:
column_no = 4;
break;
case Configuration.SCREENLAYOUT_SIZE_UNDEFINED:
column_no = 3;
break;
case Configuration.SCREENLAYOUT_SIZE_LARGE:
column_no = 3;
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
column_no = 2;
break;
case Configuration.SCREENLAYOUT_SIZE_SMALL:
column_no = 2;
break;
default:
column_no = 2;
}
}
示例3: checkScreenSize
public void checkScreenSize() {
int screenSize = getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK;
switch (screenSize) {
case Configuration.SCREENLAYOUT_SIZE_XLARGE:
column_no = 4;
break;
case Configuration.SCREENLAYOUT_SIZE_UNDEFINED:
column_no = 3;
break;
case Configuration.SCREENLAYOUT_SIZE_LARGE:
column_no = 3;
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
column_no = 2;
break;
case Configuration.SCREENLAYOUT_SIZE_SMALL:
column_no = 2;
break;
default:
column_no = 2;
}
}
示例4: setFullScreenForSmallLandscape
protected void setFullScreenForSmallLandscape() {
int nScreenSizeCategory = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
int nScreenOrientation = getResources().getConfiguration().orientation;
if (nScreenOrientation != Configuration.ORIENTATION_LANDSCAPE) {
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL) { // making it full screen in portrait mode if small screen
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
} else {
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL
|| nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) { // making it full screen in landscape mode if small or normal screen
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
}
示例5: setTitleDate
private void setTitleDate(Date date)
{
Configuration config = getResources().getConfiguration();
switch (config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)
{
case Configuration.SCREENLAYOUT_SIZE_SMALL:
setTitle(DateFormat.getDateInstance(DateFormat.MEDIUM)
.format(date));
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
switch (config.orientation)
{
case Configuration.ORIENTATION_PORTRAIT:
setTitle(DateFormat.getDateInstance(DateFormat.MEDIUM)
.format(date));
break;
case Configuration.ORIENTATION_LANDSCAPE:
setTitle(DateFormat.getDateInstance(DateFormat.FULL)
.format(date));
break;
}
break;
default:
setTitle(DateFormat.getDateInstance(DateFormat.FULL)
.format(date));
break;
}
}
示例6: setStyleOfSettingsCtrls
public void setStyleOfSettingsCtrls() {
int nScreenSizeCategory = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
int nScreenWidthPixels;
Display d = getWindowManager().getDefaultDisplay();
nScreenWidthPixels = d.getWidth();
LinearLayout linearlayoutWidthCtrl = (LinearLayout)findViewById(R.id.width_control);
if (nScreenSizeCategory != Configuration.SCREENLAYOUT_SIZE_NORMAL
&& nScreenSizeCategory != Configuration.SCREENLAYOUT_SIZE_SMALL
&& nScreenSizeCategory != Configuration.SCREENLAYOUT_SIZE_LARGE) { // xlarge
linearlayoutWidthCtrl.setLayoutParams(new LinearLayout.LayoutParams(nScreenWidthPixels/2, 0));
} else {
linearlayoutWidthCtrl.setLayoutParams(new LinearLayout.LayoutParams(nScreenWidthPixels, 0));
}
}
示例7: calcInputKeyBtnHeight
@Override
public int calcInputKeyBtnHeight() {
int nScreenSizeCategory = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
int nScreenOrientation = getResources().getConfiguration().orientation;
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int nScreenShortSideInPx = Math.min(metrics.heightPixels, metrics.widthPixels);
int nScreenLongSideInPx = Math.max(metrics.heightPixels, metrics.widthPixels);
int nBtnHeight;
if (nScreenOrientation == Configuration.ORIENTATION_LANDSCAPE) {
nBtnHeight = nScreenShortSideInPx;
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL) {
nBtnHeight /= 6;
} else if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
nBtnHeight /= 8;
} else {
// large and xlarge
nBtnHeight /= 12; // because the ads are on top
}
} else {
nBtnHeight = nScreenLongSideInPx;
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL) {
nBtnHeight /= 9;
} else if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
nBtnHeight /= 12;
} else {
// large and xlarge
nBtnHeight /= 18;
}
}
return nBtnHeight;
}
示例8: calcInputKeyBtnHeight
public int calcInputKeyBtnHeight() {
int nScreenSizeCategory = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
int nScreenOrientation = getResources().getConfiguration().orientation;
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int nScreenShortSideInPx = Math.min(metrics.heightPixels, metrics.widthPixels);
int nScreenLongSideInPx = Math.max(metrics.heightPixels, metrics.widthPixels);
int nBtnHeight;
if (nScreenOrientation == Configuration.ORIENTATION_LANDSCAPE) {
nBtnHeight = nScreenShortSideInPx;
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL) {
nBtnHeight /= 6;
} else if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
nBtnHeight /= 8;
} else {
// large and xlarge
nBtnHeight /= 12; // because the ads are on top
}
} else {
nBtnHeight = nScreenLongSideInPx;
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL) {
nBtnHeight /= 9;
} else if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
nBtnHeight /= 12;
} else {
// large and xlarge
nBtnHeight /= 18;
}
}
return nBtnHeight;
}
示例9: onConfigurationChanged
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
int nScreenSizeCategory = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
int nScreenOrientation = getResources().getConfiguration().orientation;
if (nScreenOrientation != Configuration.ORIENTATION_LANDSCAPE) {
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL) { // making it full screen in portrait mode if small screen
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
} else {
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL
|| nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) { // making it full screen in landscape mode if small or normal screen
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
if (minputMethod != null) {
// this means minputMethod has been initialized.
minputMethod.resetMetrics(); // reset the heights and font size.
minputMethod.refreshInputMethod();
minputMethod.showInputMethod(minputMethod.getSelectedPadIndex(), false);
}
setSoftKeyState(medtScriptEdtBox, mnSoftKeyState); // call this function coz we may need ads hidden.
}
示例10: hasNormalScreen
/**
* @param context Context instance
* @return [true] if the device has a normal screen, [false] otherwise.
*/
public static boolean hasNormalScreen(Context context) {
if (context == null) return false;
return getScreenSize(context) == Configuration.SCREENLAYOUT_SIZE_NORMAL;
}
示例11: setExample
public void setExample() {
int nScreenSizeCategory = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
int nNumofCurves = 1;
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL
|| nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
nNumofCurves = 2;
} else if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_LARGE) {
nNumofCurves = 2;
} else { // ex-large
nNumofCurves = 3;
}
if (nNumofCurves <= 0) {
nNumofCurves = 0;
} else if (nNumofCurves >= 3) {
nNumofCurves = 3;
}
nNumofCurves = 3;
mlistCurveSettings = new CurveSettings[nNumofCurves];
switch (nNumofCurves) {
case 3:
mlistCurveSettings[2] = new CurveSettings();
mlistCurveSettings[2].mstrCurveTitle = getString(R.string.curve_title_hint2);
mlistCurveSettings[2].mstrCurveColor = "magenta";
mlistCurveSettings[2].mstrCurvePntColor = "magenta";
mlistCurveSettings[2].mstrCurvePntStyle = "point";
mlistCurveSettings[2].mnCurvePntSize = 1;
mlistCurveSettings[2].mstrCurveLnColor = "green";
mlistCurveSettings[2].mstrCurveLnStyle = "solid";
mlistCurveSettings[2].mnCurveLnSize = 1;
mlistCurveSettings[2].mstrTFrom = "-1.5 * pi";
mlistCurveSettings[2].mstrTTo = "1.5 * pi";
mlistCurveSettings[2].mstrTStep = "0.0";
mlistCurveSettings[2].mstrXExpr = "t";
mlistCurveSettings[2].mstrYExpr = "t";
case 2:
mlistCurveSettings[1] = new CurveSettings();
mlistCurveSettings[1].mstrCurveTitle = getString(R.string.curve_title_hint);
mlistCurveSettings[1].mstrCurveColor = "blue";
mlistCurveSettings[1].mstrCurvePntColor = "blue";
mlistCurveSettings[1].mstrCurvePntStyle = "point";
mlistCurveSettings[1].mnCurvePntSize = 1;
mlistCurveSettings[1].mstrCurveLnColor = "blue";
mlistCurveSettings[1].mstrCurveLnStyle = "solid";
mlistCurveSettings[1].mnCurveLnSize = 1;
mlistCurveSettings[1].mstrTFrom = "2 * pi";
mlistCurveSettings[1].mstrTTo = "-2 * pi";
mlistCurveSettings[1].mstrTStep = ""; // auto step.
mlistCurveSettings[1].mstrXExpr = "2 * sin (4 * t)";
mlistCurveSettings[1].mstrYExpr = "t";
case 1:
mlistCurveSettings[0] = new CurveSettings();
mlistCurveSettings[0].mstrCurveTitle = getString(R.string.curve_title_hint1);
mlistCurveSettings[0].mstrCurveColor = "green";
mlistCurveSettings[0].mstrCurvePntColor = "green";
mlistCurveSettings[0].mstrCurvePntStyle = "point";
mlistCurveSettings[0].mnCurvePntSize = 1;
mlistCurveSettings[0].mstrCurveLnColor = "red";
mlistCurveSettings[0].mstrCurveLnStyle = "solid";
mlistCurveSettings[0].mnCurveLnSize = 1;
mlistCurveSettings[0].mstrTFrom = "0";
mlistCurveSettings[0].mstrTTo = "PI * 2";
mlistCurveSettings[0].mstrTStep = " "; //0.2;
mlistCurveSettings[0].mstrXExpr = "cos(t)"; //"10/(t**2 - 10 * t + 10)";
mlistCurveSettings[0].mstrYExpr = "t";
default: // 0
}
refreshCurveDefViewList();
}
示例12: setExample
public void setExample() {
int nScreenSizeCategory = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
int nNumofCurves = 1;
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL
|| nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
nNumofCurves = 2;
} else if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_LARGE) {
nNumofCurves = 2;
} else { // ex-large
nNumofCurves = 3;
}
if (nNumofCurves <= 0) {
nNumofCurves = 0;
} else if (nNumofCurves >= 3) {
nNumofCurves = 3;
}
mlistCurveSettings = new CurveSettings[nNumofCurves];
switch (nNumofCurves) {
case 3:
mlistCurveSettings[2] = new CurveSettings();
mlistCurveSettings[2].mstrCurveTitle = getString(R.string.curve_title_hint2);
mlistCurveSettings[2].mstrCurveColor = "green";
mlistCurveSettings[2].mstrCurvePntColor = "green";
mlistCurveSettings[2].mstrCurvePntStyle = "diamond";
mlistCurveSettings[2].mnCurvePntSize = 1;
mlistCurveSettings[2].mstrCurveLnColor = "green";
mlistCurveSettings[2].mstrCurveLnStyle = "solid";
mlistCurveSettings[2].mnCurveLnSize = 1;
mlistCurveSettings[2].mstrTFrom = "4";
mlistCurveSettings[2].mstrTTo = "-6";
mlistCurveSettings[2].mstrTStep = "-0.1";
mlistCurveSettings[2].mstrXExpr = "t**2/5";
mlistCurveSettings[2].mstrYExpr = "log2(abs(t)+2)";
case 2:
mlistCurveSettings[1] = new CurveSettings();
mlistCurveSettings[1].mstrCurveTitle = getString(R.string.curve_title_hint);
mlistCurveSettings[1].mstrCurveColor = "blue";
mlistCurveSettings[1].mstrCurvePntColor = "blue";
mlistCurveSettings[1].mstrCurvePntStyle = "point";
mlistCurveSettings[1].mnCurvePntSize = 1;
mlistCurveSettings[1].mstrCurveLnColor = "blue";
mlistCurveSettings[1].mstrCurveLnStyle = "solid";
mlistCurveSettings[1].mnCurveLnSize = 1;
mlistCurveSettings[1].mstrTFrom = "-5";
mlistCurveSettings[1].mstrTTo = "5";
mlistCurveSettings[1].mstrTStep = "0.1"; //"0"; // auto step.
mlistCurveSettings[1].mstrXExpr = "2*(" + getString(R.string.x_t_hint) + ")+3";
mlistCurveSettings[1].mstrYExpr = "32*(" + getString(R.string.y_t_hint) + ")"; // make the shape close to x:y == 1:1
case 1:
mlistCurveSettings[0] = new CurveSettings();
mlistCurveSettings[0].mstrCurveTitle = getString(R.string.curve_title_hint1);
mlistCurveSettings[0].mstrCurveColor = "red";
mlistCurveSettings[0].mstrCurvePntColor = "red";
mlistCurveSettings[0].mstrCurvePntStyle = "point";
mlistCurveSettings[0].mnCurvePntSize = 1;
mlistCurveSettings[0].mstrCurveLnColor = "red";
mlistCurveSettings[0].mstrCurveLnStyle = "solid";
mlistCurveSettings[0].mnCurveLnSize = 1;
mlistCurveSettings[0].mstrTFrom = "0";
mlistCurveSettings[0].mstrTTo = "6";
mlistCurveSettings[0].mstrTStep = " "; //Auto Step;
mlistCurveSettings[0].mstrXExpr = "t"; //"10/(t**2 - 10 * t + 10)";
mlistCurveSettings[0].mstrYExpr = "tan(t)";
default: // 0
}
refreshCurveDefViewList();
}
示例13: adjustMargin
public void adjustMargin() {
LinearLayout.LayoutParams llayoutParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
int nScreenSizeCategory = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
final float fScale = getResources().getDisplayMetrics().density;
int nScreenOrientation = getResources().getConfiguration().orientation;
int nMargin = 0;
if (nScreenOrientation == Configuration.ORIENTATION_LANDSCAPE) {
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL
|| nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
nMargin = 4;
} else if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_LARGE) {
nMargin = 8;
} else {
// xlarge
nMargin = 16;
}
} else {
if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_SMALL
|| nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
nMargin = 4;
} else if (nScreenSizeCategory == Configuration.SCREENLAYOUT_SIZE_LARGE) {
nMargin = 12;
} else {
// xlarge
nMargin = 32;
}
}
LinearLayout linearlayoutLevelInput = (LinearLayout)findViewById(R.id.integral_level_input);
LinearLayout linearlayoutExprInput = (LinearLayout)findViewById(R.id.integrated_expr_input);
LinearLayout linearlayoutDxInput = (LinearLayout)findViewById(R.id.dx_input);
LinearLayout linearlayoutDyInput = (LinearLayout)findViewById(R.id.dy_input);
LinearLayout linearlayoutDzInput = (LinearLayout)findViewById(R.id.dz_input);
LinearLayout linearlayoutCalculate = (LinearLayout)findViewById(R.id.integral_calculate_layout);
llayoutParams.setMargins((int)(nMargin * fScale + 0.5f),
(int)(nMargin * fScale + 0.5f),
(int)(nMargin * fScale + 0.5f),
0);
linearlayoutLevelInput.setLayoutParams(llayoutParams);
linearlayoutExprInput.setLayoutParams(llayoutParams);
linearlayoutDxInput.setLayoutParams(llayoutParams);
linearlayoutDyInput.setLayoutParams(llayoutParams);
linearlayoutDzInput.setLayoutParams(llayoutParams);
llayoutParams.setMargins((int)(nMargin * fScale + 0.5f),
(int)(nMargin * fScale + 0.5f),
(int)(nMargin * fScale + 0.5f),
(int)(nMargin * fScale + 0.5f));
linearlayoutCalculate.setLayoutParams(llayoutParams);
}