Android 8.1隐藏状态栏图标的实例代码

  

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

  

 Android 8.1隐藏状态栏图标的实例代码

  

状态栏图标的布局文件在<代码>基础框架\ \包\ \ status_bar SystemUI \ res \布局。xml> android:可见性=耙巍?/代码>或者“消失”即可

        & lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;比;   & lt; !   Arunachal Pradesh,   * * 2006年版权,Android开源项目   Arunachal Pradesh,   在Apache许可下许可的* *,2.0版本(“许可证”);   * *你可能不使用这个文件除了遵守许可证。   * *你可能获得许可证的副本   Arunachal Pradesh,   * * http://www.apache.org/licenses/license - 2.0   Arunachal Pradesh,   * *除非适用法律要求或书面同意,软件   * *在许可证下发布的分布——比;   & lt; 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:背景=" @drawable/system_bar_background”   android:取向=按怪薄?   android: focusable=" false "   android: descendantFocusability=" afterDescendants "   比;   & lt; ImageView   android: id=癅 + id/notification_lights_out”   android: layout_width=" 0 dp”   android: layout_height=" match_parent "   android: paddingStart=" 6浸"   android: paddingBottom=" 2下降”   android: src=" https://www.yisu.com/zixun/@drawable ic_sysbar_lights_out_dot_small "   android: scaleType="中心"   android:可见性="了"/比;   & lt; LinearLayout android: id=癅 + id/status_bar_contents”   android: layout_width=" match_parent "   android: layout_height=" match_parent "   android: paddingStart=" 6 dp "   android: paddingEnd=" 8 dp "   面向android:="水平"   比;   & lt; !——这个地区的αPhoneStatusBarTransitions和控制   PhoneStatusBar (DISABLE_NOTIFICATION_ICONS)。——比;   & lt; com.android.systemui.statusbar.AlphaOptimizedFrameLayout   android: id=癅 + id/notification_icon_area”   android: layout_width=" 0下降”   android: layout_height=" match_parent "   android: layout_weight=" 1 "   android:可见性=耙巍?   面向android:="水平"/比;   & lt; com.android.keyguard。AlphaOptimizedLinearLayout android: id=癅 + id/system_icon_area”   android: layout_width=" wrap_content "   android: layout_height=" match_parent "   面向android:="水平"   比;   & lt;包括布局=癅layout/system_icons”/比;   & lt; com.android.systemui.statusbar.policy.Clock   android: id=癅 + id/时钟”   android: textAppearance=" @style/TextAppearance.StatusBar.Clock”   android: layout_width=" wrap_content "   android: layout_height=" match_parent "   android:单行模式=" true "   android: paddingStart=" @dimen/status_bar_clock_starting_padding”   android: paddingEnd=" @dimen/status_bar_clock_end_padding”   android:重力=" center_vertical |开始”/比;   & lt;/com.android.keyguard.AlphaOptimizedLinearLayout>   & lt;/LinearLayout>   & lt; ViewStub   android: id=癅 + id/emergency_cryptkeeper_text”   android: layout_width=" wrap_content "   android: layout_height=" match_parent "   android:布局=" @layout/emergency_cryptkeeper_text”/比;   & lt;/com.android.systemui.statusbar.phone.PhoneStatusBarView>   & lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;祝辞& lt; !—   ~ 2014年版权(C) Android开源项目   ~   ~在Apache许可下的,2.0版本(“许可证”);   ~你可能不使用这个文件除了遵守许可证。   ~你可以获得许可证的副本   ~   ~ http://www.apache.org/licenses/license - 2.0   ~   ~除非适用法律要求或书面同意,软件   ~在许可证下发布的分布   android: id=癅 + id/system_icons”   android: layout_width=" wrap_content "   android: layout_height=" match_parent "   android:重力=癱enter_vertical”比;   & lt; com.android.keyguard。AlphaOptimizedLinearLayout android: id=癅 + id/statusIcons”   android: layout_width=" wrap_content "   android: layout_height=" match_parent "   android:重力=" center_vertical "   android:可见性=耙巍?   面向android:="水平"/比;   & lt;包括布局=癅layout/signal_cluster_view”   android:可见性=耙巍?   android: layout_width=" wrap_content "   android: layout_height=" wrap_content "   android: layout_marginStart=癅dimen/signal_cluster_margin_start”/比;   & lt; com.android.systemui。BatteryMeterView android: id=癅 + id/电池”   android: layout_height=" match_parent "   android: layout_width=" wrap_content "/比;   & lt;/LinearLayout>

Android 8.1隐藏状态栏图标的实例代码