怎么隐藏android studio 顶部显示的文件路径,还有哪个导航栏
在n**igationbar的布局左部加入一个button(在systemui模块实现),点击隐藏n**igationbar,即将n**igationbar从windowmanager中移除掉。需要的时候,通过一个从屏幕底部向上的滑动手势(在policy模块实现)调出n**igationbar。如下两图对比所示:一张为移除前,另一张为移除后。 具体实现: ①.增加按钮实现动态隐藏,主要修改在frameworks/base/packages/systemui模块,首先我们增加一个按钮,主要修改 frameworks/base/packages/systemui/res/layout/n**igation_bar.xml文件,图片资源和字符串我就不提了,具体如下: diff --git a/frameworks/base/packages/systemui/res/layout/n**igation_bar.xml b/frameworks/base/packages/systemui/res/layout/n**igation_bar.xmlindex 16027d9..326aafc 100644--- a/frameworks/base/packages/systemui/res/layout/n**igation_bar.xml+++ b/frameworks/base/packages/systemui/res/layout/n**igation_bar.xml@@ -42,12 +42,28 @@ >+ + <framelayout android:layout_height="match_parent" android:layout_weight="0" android:layout_width="@dimen/n**igation_extra_key_width">+ ++ </framelayout>+ + + <framelayout android:layout_height="40dp" android:layout_weight="0" android:layout_width="match_parent">++ + </framelayout>+ 接下来修改frameworks/base/packages/systemui/src/com/android/systemui/statu**ar/phone/n**igationbarview.j**a,为按钮提供一个接口,具体如下: diff --git a/frameworks/base/packages/systemui/src/com/android/systemui/statu**ar/phone/n**igationbarview.j**a b/frameworks/base/packages/systemui/src/com/android/systemui/statu**ar/phone/n**igationbarview.j**aindex 88e71e2..7545984 100644--- a/frameworks/base/packages/systemui/src/com/android/systemui/statu**ar/phone/n**igationbarview.j**a+++ b/frameworks/base/packages/systemui/src/com/android/systemui/statu**ar/phone/n**igationbarview.j**a@@ -45,6 +45,7 @@ import com.android.systemui.r; import com.android.systemui.statu**ar.basestatu**ar; import com.android.systemui.statu**ar.delegateviewhelper; import com.android.systemui.statu**ar.policy.deadzone;+import com.android.systemui.statu**ar.policy.keybuttonripple; import com.android.systemui.statu**ar.policy.keybuttonview; import j**a.io.filedescriptor;@@ -265,6 +266,13 @@ public class n**igationbarview extends linearlayout { public view getimeswitchbutton() { return mcurrentview.findviewbyid(r.id.ime_switcher); }+ //begin liweiping+ public view gethidebarbutton() {+ view view = mcurrentview.findviewbyid(r.id.hide_bar_btn);+ view.setbackground(new keybuttonripple(getcontext(), view));+ return view;+ }+ //end liweiping private void geticons(resources res) { mbackicon = res.getdrawable(r.drawable.ic_sy**ar_back);@@ -412,7 +420,6 @@ public class n**igationbarview extends linearlayout { mcurrentview = mrotatedviews[surface.rotation_0]; getimeswitchbutton().setonclickl**tener(mimeswitcherclickl**tener);- updatertlorder(); } 最后便是在frameworks/base/packages/systemui/src/com/android/systemui/statu**ar/phone/phonestatu**ar.j**a实现点击事件了: + private final onclickl**tener mhidebarclickl**tener = new onclickl**tener() {+ @override+ public void onclick(view view) {+ log.i(way, mhidebarclickl**tener onclick...);+ removen**igationbar();+ }+ };+ private void removen**igationbar() {+ if (debug) log.d(tag, removen**igationbar: about to remove + mn**igationbarview);+ if (mn**igationbarview == **) return;++ mwindowmanager.removeview(mn**igationbarview);+ mn**igationbarview = **;+ } 到此,隐藏n**igationbar告一段落了。附上出处链接: 20210311