去掉安卓原生状态栏及下拉菜单

去掉状态栏

1,StatusBar 属于系统app,在SystemUI下,该文件位于android_src/frameworks/base/packages 下面(其中android_src指的是你的android源码路径)


2,打开SystemUI的src目录SystemUI/src/com/android/systemui/statusbar 里面有个StatusBar.java类,使用编辑器打开这个java类


3,在第一方法start()里面一开始便有一个View sb = makeStatusBarView(); 其实这就是状态栏的view了(其实这是一个抽象类,实际调用的是继承它的子类的实现方法),那么在他返回后,既然是View那么可以这么想了,将它设为Invisible那就可以将其隐藏,所以在后面加入一句自己的代码:
 sb.setVisibility(View.INVISIBLE);

 

android view setVisibility():
有三个参数:Parameters:visibility One of VISIBLE, INVISIBLE, or GONE,想对应的三个常量值:0、4、8
VISIBLE:0 意思是可见的
INVISIBILITY:4 意思是不可见的,但还占着原来的空间
GONE:8 意思是不可见的,不占用原来的布局空间

 

去掉下拉菜单

diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index c80b3ad..4df6860 100644
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -121,17 +121,20 @@ public class PhoneStatusBarView extends PanelBar {

     @Override
     public boolean onTouchEvent(MotionEvent event) {
-        boolean barConsumedEvent = mBar.interceptTouchEvent(event);
-
-        if (DEBUG_GESTURES) {
-            if (event.getActionMasked() != MotionEvent.ACTION_MOVE) {
-                EventLog.writeEvent(EventLogTags.SYSUI_PANELBAR_TOUCH,
-                        event.getActionMasked(), (int) event.getX(), (int) event.getY(),
-                        barConsumedEvent ? 1 : 0);
-            }
-        }
-
-        return barConsumedEvent || super.onTouchEvent(event);
+           return true;
+/*
+ *         boolean barConsumedEvent = mBar.interceptTouchEvent(event);
+ *
+ *         if (DEBUG_GESTURES) {
+ *             if (event.getActionMasked() != MotionEvent.ACTION_MOVE) {
+ *                 EventLog.writeEvent(EventLogTags.SYSUI_PANELBAR_TOUCH,
+ *                         event.getActionMasked(), (int) event.getX(), (int) event.getY(),
+ *                         barConsumedEvent ? 1 : 0);
+ *             }
+ *         }
+ *
+ *         return barConsumedEvent || super.onTouchEvent(event);
+ */
     }

     @Override
(END)

禁止锁屏

diff --git a/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
index f4cefc2..7734cfd 100644 (file)
--- a/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
+++ b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
@@ -80,7 +80,7 @@
     /system/media/audio/ui/Trusted.ogg
     /system/media/audio/ui/WirelessChargingStarted.ogg
 
-    false
+    true
     false
     1

 

你可能感兴趣的:(android相关)