1 在mobile_signal_group布局中增加
<TextView
android:id="@+id/carrier_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/keyguard_carrier_text_margin"
android:layout_toStartOf="@id/system_icons_super_container"
android:gravity="center_vertical"
android:textColor="#ffffff"
android:fontFamily="sans-serif-light"
android:textAppearance="?android:attr/textAppearanceSmall"
android:singleLine="true" />
在SinglaClusterView的内部类PhoneState中增加如下代码:
private TextView displayName;
private SubscriptionManager mSubscriptionManager;
private SubscriptionInfo sir;
public PhoneState(int subId, Context context) {
mSubscriptionManager =SubscriptionManager.from(context);
sir = mSubscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(mSubscriptionManager.getSlotId(subId));
mSubscriptionManager.addOnSubscriptionsChangedListener(mSubscriptionListener);
ViewGroup root = (ViewGroup) LayoutInflater.from(context)
.inflate(R.layout.mobile_signal_group_ext, null);
/// M: Add data group for plugin feature. @ {
mPhoneStateExt = PluginManager.getSystemUIStatusBarExt(context);
mPhoneStateExt.addCustomizedView(subId, context, root);
setViews(root);
//displayName.setText(sir.getCarrierName());
mSubId = subId;
}

本文介绍了Android 7.0中如何在状态栏显示运营商名称,通过SubscriptionInfo的getDisplayName获取,避免因用户自定义运营商名称导致显示问题。详细讲解了SubscriptionManager的相关字段,如ICC_ID、DISPLAY_NAME、NAME_SOURCE等,并阐述了其作用,包括获取和修改SubScriptionInfo,以及提供状态改变监听器。
最低0.47元/天 解锁文章

3671

被折叠的 条评论
为什么被折叠?



