Android 8.1隐藏状态栏图标

Android 8.1隐藏状态栏图标,第1张

概述近期客户需求,状态栏只显示时间和电池图标,如图 状态栏图标的布局文件在frameworks\base\packages\SystemUI\res\layout\status_bar.xml,主要包括通知,定位,蓝牙,信号,时间,电池等图标,只要在相应的布局文件中加入属性android:visibility="invisible"或者“gone”即可<?xmlversio

近期客户需求,状态栏只显示时间和电池图标,如图 

状态栏图标的布局文件在frameworks\base\packages\systemUI\res\layout\status_bar.xml,主要包括通知,定位,蓝牙,信号,时间,电池等图标,只要在相应的布局文件中加入属性androID:visibility="invisible" 或者“gone”即可

<?xml version="1.0" enCoding="utf-8"?><!--**** copyright 2006, The AndroID Open Source Project**** licensed under the Apache license, Version 2.0 (the "license"); ** you may not use this file except in compliance with the license. ** You may obtain a copy of the license at ****     http://www.apache.org/licenses/liCENSE-2.0 **** Unless required by applicable law or agreed to in writing, software ** distributed under the license is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implIEd. ** See the license for the specific language governing permissions and ** limitations under the license.*/--><!--    androID:background="@drawable/status_bar_closed_default_background" --><com.androID.systemUI.statusbar.phone.PhonestatusbarVIEw    xmlns:androID="http://schemas.androID.com/apk/res/androID"    xmlns:systemUI="http://schemas.androID.com/apk/res/com.androID.systemUI"    androID:layout_wIDth="match_parent"    androID:layout_height="@dimen/status_bar_height"    androID:ID="@+ID/status_bar"    androID:background="@drawable/system_bar_background"    androID:orIEntation="vertical"    androID:focusable="false"    androID:descendantFocusability="afterDescendants"    >    <ImageVIEw        androID:ID="@+ID/notification_lights_out"        androID:layout_wIDth="0dp"        androID:layout_height="match_parent"        androID:paddingStart="6dip"        androID:paddingBottom="2dip"        androID:src="@drawable/ic_sysbar_lights_out_dot_small"        androID:scaleType="center"        androID:visibility="gone"        />    <linearLayout androID:ID="@+ID/status_bar_contents"        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        androID:paddingStart="6dp"        androID:paddingEnd="8dp"        androID:orIEntation="horizontal"        >        <!-- The Alpha of this area is controlled from both PhonestatusbarTransitions and             Phonestatusbar (disABLE_NOTIFICATION_ICONS). -->        <com.androID.systemUI.statusbar.AlphaOptimizedFrameLayout            androID:ID="@+ID/notification_icon_area"            androID:layout_wIDth="0dip"            androID:layout_height="match_parent"            androID:layout_weight="1"            androID:visibility="invisible"            androID:orIEntation="horizontal" />        <com.androID.keyguard.AlphaOptimizedlinearLayout androID:ID="@+ID/system_icon_area"            androID:layout_wIDth="wrap_content"            androID:layout_height="match_parent"            androID:orIEntation="horizontal"            >            <include layout="@layout/system_icons" />            <com.androID.systemUI.statusbar.policy.Clock                androID:ID="@+ID/clock"                androID:textAppearance="@style/TextAppearance.Statusbar.Clock"                androID:layout_wIDth="wrap_content"                androID:layout_height="match_parent"                androID:singleline="true"                androID:paddingStart="@dimen/status_bar_clock_starting_padding"                androID:paddingEnd="@dimen/status_bar_clock_end_padding"                androID:gravity="center_vertical|start"                />        </com.androID.keyguard.AlphaOptimizedlinearLayout>    </linearLayout>    <VIEwStub        androID:ID="@+ID/emergency_cryptkeeper_text"        androID:layout_wIDth="wrap_content"        androID:layout_height="match_parent"        androID:layout="@layout/emergency_cryptkeeper_text"    /></com.androID.systemUI.statusbar.phone.PhonestatusbarVIEw>
<?xml version="1.0" enCoding="utf-8"?><!--  ~ copyright (C) 2014 The AndroID Open Source Project  ~  ~ licensed under the Apache license, Version 2.0 (the "license");  ~ you may not use this file except in compliance with the license.  ~ You may obtain a copy of the license at  ~  ~      http://www.apache.org/licenses/liCENSE-2.0  ~  ~ Unless required by applicable law or agreed to in writing, software  ~ distributed under the license is distributed on an "AS IS" BASIS,  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implIEd.  ~ See the license for the specific language governing permissions and  ~ limitations under the license  --><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:ID="@+ID/system_icons"    androID:layout_wIDth="wrap_content"    androID:layout_height="match_parent"    androID:gravity="center_vertical">    <com.androID.keyguard.AlphaOptimizedlinearLayout androID:ID="@+ID/statusIcons"        androID:layout_wIDth="wrap_content"        androID:layout_height="match_parent"        androID:gravity="center_vertical"        androID:visibility="invisible"        androID:orIEntation="horizontal"/>    <include layout="@layout/signal_cluster_vIEw"        androID:visibility="invisible"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:layout_marginStart="@dimen/signal_cluster_margin_start"/>    <com.androID.systemUI.BatteryMeterVIEw androID:ID="@+ID/battery"        androID:layout_height="match_parent"        androID:layout_wIDth="wrap_content"        /></linearLayout>

 

总结

以上是内存溢出为你收集整理的Android 8.1隐藏状态栏图标全部内容,希望文章能够帮你解决Android 8.1隐藏状态栏图标所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1065126.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存