您的位置:首页 > 移动开发 > Android开发

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

2012-12-06 13:01 417 查看
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);
    }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: