现在的位置: 首页 > 综合 > 正文

android4.0隐藏状态栏电池图标

2013年09月22日 ⁄ 综合 ⁄ 共 1212字 ⁄ 字号 评论关闭

frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java

import com.android.systemui.R;

public class BatteryController extends BroadcastReceiver {
    private static final String TAG = "StatusBar.BatteryController";

    private Context mContext;
    private ArrayList<ImageView> mIconViews = new ArrayList<ImageView>();
    private ArrayList<TextView> mLabelViews = new ArrayList<TextView>();

    public BatteryController(Context context) {
        mContext = context;

        IntentFilter filter = new IntentFilter();
        /* delete by Gary. start {{----------------------------------- */
        /* 2012-4-5 */
        /* hide the battery icon in the statusbar */
// filter.addAction(Intent.ACTION_BATTERY_CHANGED);

        /* delete by Gary. end -----------------------------------}} */
        context.registerReceiver(this, filter);
    }

   public void addIconView(ImageView v) {
        /* add by Gary. start {{----------------------------------- */
        /* 2012-4-5 */
        /* hide the battery icon in the statusbar */
        v.setVisibility(View.GONE);
        /* add by Gary. end -----------------------------------}} */
        mIconViews.add(v);
    }

    public void addLabelView(TextView v) {
        /* add by Gary. start {{----------------------------------- */
        /* 2012-4-5 */
        /* hide the battery icon in the statusbar */
        v.setVisibility(View.GONE);
        /* add by Gary. end -----------------------------------}} */
        mLabelViews.add(v);
    }

抱歉!评论已关闭.