Android 修改横屏角度为顺时针270度,37岁程序员被裁
2022/1/31 14:35:58
本文主要是介绍Android 修改横屏角度为顺时针270度,37岁程序员被裁,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
if (res.getBoolean(com.android.internal.R.bool.config_reverseDefaultRotation)) {
mPortraitRotation = Surface.ROTATION_90;
mUpsideDownRotation = Surface.ROTATION_270;
} else {
mPortraitRotation = Surface.ROTATION_270;
mUpsideDownRotation = Surface.ROTATION_90;
}
} else {
shortSize = width;
longSize = height;
mPortraitRotation = Surface.ROTATION_0;
mUpsideDownRotation = Surface.ROTATION_180;
if (res.getBoolean(com.android.internal.R.bool.config_reverseDefaultRotation)) {
mLandscapeRotation = Surface.ROTATION_270;
mSeascapeRotation = Surface.ROTATION_90;
} else {
mLandscapeRotation = Surface.ROTATION_90;
mSeascapeRotation = Surface.ROTATION_270;
}
}
mStatusBarHeight =
res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
// Height of the navigation bar when presented horizontally at bottom
mNavigationBarHeightForRotation[mPortraitRotation] =
mNavigationBarHeightForRotation[mUpsideDownRotation] =
res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_height);
mNavigationBarHeightForRotation[mLandscapeRotation] =
mNavigationBarHeightForRotation[mSeascapeRotation] = res.getDimensionPixelSize(
com.android.internal.R.dimen.navigation_bar_height_landscape);
// Width of the navigation bar when presented vertically along one side
mNavigationBarWidthForRotation[mPortraitRotation] =
mNavigationBarWidthForRotation[mUpsideDownRotation] =
mNavigationBarWidthForRotation[mLandscapeRotation] =
mNavigationBarWidthForRotation[mSeascapeRotation] =
res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_width);
// SystemUI (status bar) layout policy
int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / density;
int longSizeDp = longSize * DisplayMetrics.DENSITY_DEFAULT / density;
// Allow the navigation bar to move on small devices (phones).
/// M: read the critical dp from mtk resource @{
//mNavigationBarCanMove = shortSizeDp < 600;
mNavigationBarCanMove = shortSizeDp < mContext.getResources().getInteger(
com.mediatek.internal.R.integer.config_dp_for_rotation);
/// @}
mHasNavigationBar = res.getBoolean(com.android.internal.R.bool.config_showNavigationBar);
/// M:[SmartBook]Don’t show navigation bar if SmartBook plugged in @{
if (FeatureOption.MTK_SMARTBOOK_SUPPORT) {
mNavigationBarCanMove = false;
mHasNavigationBar = mSmartBookPlugIn ? false : mContext.getResources().getBoolean(
com.android.internal.R.bool.con
fig_showNavigationBar);
Slog.d(TAG, “mSmartBookPlugIn:” + mSmartBookPlugIn + “, mHasNavigationBar:” + mHasNavigationBar);
}
/// @}
// Allow a system property to override this. Used by the emulator.
// See also hasNavigationBar().
String navBarOverride = SystemProperties.get(“qemu.hw.mainkeys”);
if (“1”.equals(navBarOverride)) {
mHasNavigationBar = false;
} else if (“0”.equals(navBarOverride)) {
mHasNavigationBar = true;
}
// For demo purposes, allow the rotation of the HDMI display to be controlled.
// By default, HDMI locks rotation to landscape.
if (“portrait”.equals(SystemProperties.get(“persist.demo.hdmirotation”))) {
mDemoHdmiRotation = mPortraitRotation;
} else {
mDemoHdmiRotation = mLandscapeRotation;
}
mDemoHdmiRotationLock = SystemProperties.getBoolean(“persist.demo.hdmirotationlock”, false);
// Only force the default orientation if the screen is xlarge, at least 960dp x 720dp, per
// http://developer.android.com/guide/practices/screens_support.html#range
force the default orientation if the screen is xlarge, at least 960dp x 720dp, per
// http://developer.android.com/guide/practices/screens_support.html#range
这篇关于Android 修改横屏角度为顺时针270度,37岁程序员被裁的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-01-18android.permission.read_media_video
- 2024-01-18android_getaddrinfo failed eai_nodata
- 2024-01-18androidmo
- 2024-01-15Android下三种离屏渲染技术
- 2024-01-09Android 蓝牙使用
- 2024-01-06Android对接华为AI - 文本识别
- 2023-11-15代码安全之代码混淆及加固(Android)
- 2023-11-10简述Android语音播报TTS
- 2023-11-06Android WiFi工具类
- 2023-07-22Android开发未来的出路