SystemUI自定义的状态栏信号view
frameworks\base\packages\SystemUI\src\com\android\systemui\statusbar\SignalClusterView.java
所在的自定义的布局
frameworks\base\packages\SystemUI\res\layout\
其中一个
gemini_signal_cluster_view.xml
signal_cluster_view.xml//9200B
添加图标或者文字在信号栏后面
android:id="@+id/mobile_slot_indicator_4"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginStart="1dp"
android:visibility="gone"
android:tag="mobile_slot_indicator_4"
/>
android:id="@+id/custom_signal_4g" android:layout_height="wrap_content" android:layout_width="wrap_content" android:visibility="gone" android:background="@drawable/stat_sys_gemini_signal_4g_blue" /> android:id="@+id/custom_signal_volte" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginLeft="3dp" android:visibility="gone" android:background="@drawable/stat_sys_volte" /> private ImageView custom_signal_4g; private ImageView custom_signal_volte; @Override protected voidonAttachedToWindow() { super.onAttachedToWindow(); //add 4g state lhw start 初始化控件 custom_signal_4g = (ImageView)findViewById(R.id.custom_signal_4g); custom_signal_volte = (ImageView)findViewById(R.id.custom_signal_volte); 进行信号栏状态跟随当前信号状态变化显示,无信号时做判断 if (mMobileStrengthId[i][0].getIconId() ==PluginFactory.getStatusBarPlugin(mContext).getSignalStrengthNullIconGemini(i) ||mMobileStrengthId[i][0].getIconId() == 0 || mMobileStrengthId[i][0].getIconId()== R.drawable.stat_sys_gemini_signal_null) {//找到无信号地方进行操作 mMobileRoam[i].setVisibility(View.GONE); //show custom network state lhw start custom_signal_4g.setVisibility(View.GONE); custom_signal_volte.setVisibility(View.GONE); } //showcustom network state lhw start else{ custom_signal_4g.setVisibility(View.VISIBLE); custom_signal_volte.setVisibility(View.VISIBLE); } //showcustom network state lhw end 隐藏手机带的信号 SystemUI\src\com\android\systemui\statusbar\policy\TelephonyIcons.java //这里显示的是信号状态条上的网络状态标志3g/4g/2g等替换资源图片为空白 static final int[] DATA_G= { static final int[]DATA_3G = { static final int[] DATA_E= { //这里显示的是信号状态前面的的大的网络状态标志3G/4G/2G等 static final int[]NETWORK_TYPE_G = { static final int[]NETWORK_TYPE_3G = { static final int[]NETWORK_TYPE_4G = { static public int getNetworkTypeIconGemini(NetworkTypenetworkType, int simColorId) { if (networkType == NetworkType.Type_G) { // return NETWORK_TYPE_G[simColorId]; return 0; //修改为 0 让其函数对外无显示 } else if (networkType == NetworkType.Type_3G) { return NETWORK_TYPE_3G[simColorId]; } else if (networkType == NetworkType.Type_4G) { return NETWORK_TYPE_4G[simColorId]; } else { return -1; }