zoukankan      html  css  js  c++  java
  • 自定义ActionBar完全覆盖系统的

     //加载ActionBar的方法
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            // getMenuInflater().inflate(R.menu.main, menu);
    
            setActionBarLayout(R.layout.actionbar_twelve_trailer_pass, this);  //layout是自己定义的布局
         return true;
        }
    
        //加载ActionBar的方法
        public void setActionBarLayout(int layoutId, Context mContext) {
            ActionBar actionBar = getSupportActionBar();
            if (null != actionBar) {
                actionBar.setDisplayShowHomeEnabled(false);
                actionBar.setDisplayShowCustomEnabled(true);
                actionBar.setDisplayOptions(DISPLAY_SHOW_CUSTOM);
                LayoutInflater inflator = (LayoutInflater) this
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                View v = inflator.inflate(layoutId, new LinearLayout(mContext),
                        false);
                ActionBar.LayoutParams layout = new ActionBar.LayoutParams(
                        ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT);
                actionBar.setCustomView(v, layout);
            }
        }
  • 相关阅读:
    HDU_5057_分块
    HYSBZ_2002_分块
    HDU_1166_树状数组
    HDU_5692_dfs序+线段树
    多重背包
    二进制中一的个数
    康托展开
    vector, map, queue,set常用总结
    错误票据
    高精度计算
  • 原文地址:https://www.cnblogs.com/niupi/p/5736726.html
Copyright © 2011-2022 走看看