9 个解决方案
#1
android 4.1.2及以前版本 SystemUI根据代码判别 isTable isPhone 来显示的 android4.2.2版是
手机布局 显示在最顶部 只感觉android 4.2.2 的平板好别扭~
#2
我的源码是4.0.3是平板电脑,所以显示在下面,但是我想显示在上面。所以我想问一下在哪里判断是用哪个位置的?
#3
我问过搞SystemUI的同事了 好像要改framework层 res路径下的布局 具体的我也是不太清楚
#4
http://asysbang.com/forum.php?mod=viewthread&tid=15&extra=page%3D1
#5
我的源码和系统直接用作table的bar
#6
public void setInitialDisplaySize(int width, int height) {
int shortSize;
if (width > height) {
shortSize = height;
mLandscapeRotation = Surface.ROTATION_0;
mSeascapeRotation = Surface.ROTATION_180;
if (mContext.getResources().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;
mPortraitRotation = Surface.ROTATION_0;
mUpsideDownRotation = Surface.ROTATION_180;
if (mContext.getResources().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;
}
}
// Determine whether the status bar can hide based on the size
// of the screen. We assume sizes > 600dp are tablets where we
// will use the system bar.
int shortSizeDp = shortSize
* DisplayMetrics.DENSITY_DEFAULT
/ DisplayMetrics.DENSITY_DEVICE;
mStatusBarCanHide = shortSizeDp < 600;
mStatusBarHeight = mContext.getResources().getDimensionPixelSize(
mStatusBarCanHide
? com.android.internal.R.dimen.status_bar_height
: com.android.internal.R.dimen.system_bar_height);
mHasNavigationBar = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_showNavigationBar);
// Allow a system property to override this. Used by the emulator.
// See also hasNavigationBar().
String navBarOverride = SystemProperties.get("qemu.hw.mainkeys");
if (! "".equals(navBarOverride)) {
if (navBarOverride.equals("1")) mHasNavigationBar = false;
else if (navBarOverride.equals("0")) mHasNavigationBar = true;
}
mNavigationBarHeight = mHasNavigationBar
? mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.navigation_bar_height)
: 0;
mNavigationBarWidth = mHasNavigationBar
? mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.navigation_bar_width)
: 0;
if ("portrait".equals(SystemProperties.get("persist.demo.hdmirotation"))) {
mHdmiRotation = mPortraitRotation;
} else {
mHdmiRotation = mLandscapeRotation;
}
}
#7
我分析的代码是4.1的,
4.0的代码看了下应该也差不多少,
控制下mHasNavigationBar 这个变量试试看
有结果了 告诉我下哦 我完善下我的总结
4.0的代码看了下应该也差不多少,
控制下mHasNavigationBar 这个变量试试看
有结果了 告诉我下哦 我完善下我的总结
#8
config_showNavigationBar原来系统是false的,但是改为true后发现状态栏都不见了
#9
mStatusBarCanHide = shortSizeDp < 600; 系统是根据这个判断来指定是显示tabletUI和PhoneUI的,还有qemu.hw.mainkeys的值
#1
android 4.1.2及以前版本 SystemUI根据代码判别 isTable isPhone 来显示的 android4.2.2版是
手机布局 显示在最顶部 只感觉android 4.2.2 的平板好别扭~
#2
我的源码是4.0.3是平板电脑,所以显示在下面,但是我想显示在上面。所以我想问一下在哪里判断是用哪个位置的?
#3
我问过搞SystemUI的同事了 好像要改framework层 res路径下的布局 具体的我也是不太清楚
#4
http://asysbang.com/forum.php?mod=viewthread&tid=15&extra=page%3D1
#5
我的源码和系统直接用作table的bar
#6
public void setInitialDisplaySize(int width, int height) {
int shortSize;
if (width > height) {
shortSize = height;
mLandscapeRotation = Surface.ROTATION_0;
mSeascapeRotation = Surface.ROTATION_180;
if (mContext.getResources().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;
mPortraitRotation = Surface.ROTATION_0;
mUpsideDownRotation = Surface.ROTATION_180;
if (mContext.getResources().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;
}
}
// Determine whether the status bar can hide based on the size
// of the screen. We assume sizes > 600dp are tablets where we
// will use the system bar.
int shortSizeDp = shortSize
* DisplayMetrics.DENSITY_DEFAULT
/ DisplayMetrics.DENSITY_DEVICE;
mStatusBarCanHide = shortSizeDp < 600;
mStatusBarHeight = mContext.getResources().getDimensionPixelSize(
mStatusBarCanHide
? com.android.internal.R.dimen.status_bar_height
: com.android.internal.R.dimen.system_bar_height);
mHasNavigationBar = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_showNavigationBar);
// Allow a system property to override this. Used by the emulator.
// See also hasNavigationBar().
String navBarOverride = SystemProperties.get("qemu.hw.mainkeys");
if (! "".equals(navBarOverride)) {
if (navBarOverride.equals("1")) mHasNavigationBar = false;
else if (navBarOverride.equals("0")) mHasNavigationBar = true;
}
mNavigationBarHeight = mHasNavigationBar
? mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.navigation_bar_height)
: 0;
mNavigationBarWidth = mHasNavigationBar
? mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.navigation_bar_width)
: 0;
if ("portrait".equals(SystemProperties.get("persist.demo.hdmirotation"))) {
mHdmiRotation = mPortraitRotation;
} else {
mHdmiRotation = mLandscapeRotation;
}
}
#7
我分析的代码是4.1的,
4.0的代码看了下应该也差不多少,
控制下mHasNavigationBar 这个变量试试看
有结果了 告诉我下哦 我完善下我的总结
4.0的代码看了下应该也差不多少,
控制下mHasNavigationBar 这个变量试试看
有结果了 告诉我下哦 我完善下我的总结
#8
config_showNavigationBar原来系统是false的,但是改为true后发现状态栏都不见了
#9
mStatusBarCanHide = shortSizeDp < 600; 系统是根据这个判断来指定是显示tabletUI和PhoneUI的,还有qemu.hw.mainkeys的值