美文网首页
android9.0 修改状态栏图标的顺序

android9.0 修改状态栏图标的顺序

作者: 小二小二小二 | 来源:发表于2020-06-17 18:21 被阅读0次

    原理

    com.android.systemui.statusbar.phone/StatusBarIconControllerImpl.java类的构造方法中读取
    com.android.internal.R.array.config_statusBarIcons,按照此数组的顺序排序,如果需要修改顺序,则需要修改此文件。

     public StatusBarIconControllerImpl(Context context) {
            super(context.getResources().getStringArray(
                    com.android.internal.R.array.config_statusBarIcons), context);
            Dependency.get(ConfigurationController.class).addCallback(this);
    
            mContext = context;
    
            loadDimens();
    
            SysUiServiceProvider.getComponent(context, CommandQueue.class)
                    .addCallbacks(this);
            Dependency.get(TunerService.class).addTunable(this, ICON_BLACKLIST);
    
        }
    

    /frameworks/base/core/res/res/values/config.xml

     <string-array name="config_statusBarIcons">
            <item><xliff:g id="id">@string/status_bar_alarm_clock</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_rotate</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_headset</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_data_saver</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_ime</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_sync_failing</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_sync_active</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_nfc</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_tty</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_speakerphone</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_cdma_eri</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_data_connection</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_phone_evdo_signal</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_phone_signal</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_secure</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_bluetooth</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_managed_profile</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_cast</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_vpn</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_mute</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_volume</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_location</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_zen</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_ethernet</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_wifi</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_hotspot</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_mobile</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_airplane</xliff:g></item>
            <item><xliff:g id="id">@string/status_bar_battery</xliff:g></item>
        </string-array>
    

    相关文章

      网友评论

          本文标题:android9.0 修改状态栏图标的顺序

          本文链接:https://www.haomeiwen.com/subject/nsasxktx.html