我用同一个状态栏的源码,但是放在不同尺寸大小的设备里的时候,发现状态栏显示的位置不一样,有的显示在顶部,有的显示在底部,systemui是根据哪里判断位置的显示的啊
解决方案 »
- 数据同步到本地SQLite数据库上
- 关于4.0全屏的问题,有人解决吗
- 怎么监听当前屏幕的触摸事件,不是在当前的应用程序activity里面,而是在点击其他的应用事触发这些事件
- Matrix 用于旋转时,怎么设置它绕某个特定的 点 旋转?
- handler.sendMessage失败
- 新手请教这样一个项目是如何创建的
- ? - TextView.setEms什么意思
- Android 访问Webservice的问题
- 关于xml pull解析的问题
- 关于android边下边放音乐的问题,怎样解决载入缓冲数据时停顿一下这个问题
- 求教:如何测试当前的wifi的网速?
- 基于Android平台淘宝网手机客户端实战开发视频教程
android 4.1.2及以前版本 SystemUI根据代码判别 isTable isPhone 来显示的 android4.2.2版是手机布局 显示在最顶部 只感觉android 4.2.2 的平板好别扭~
我问过搞SystemUI的同事了 好像要改framework层 res路径下的布局 具体的我也是不太清楚
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;
}
}
4.0的代码看了下应该也差不多少,
控制下mHasNavigationBar 这个变量试试看
有结果了 告诉我下哦 我完善下我的总结