当前位置: 首页>>代码示例>>Java>>正文


Java ActionBar.LayoutParams方法代码示例

本文整理汇总了Java中android.support.v7.app.ActionBar.LayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java ActionBar.LayoutParams方法的具体用法?Java ActionBar.LayoutParams怎么用?Java ActionBar.LayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v7.app.ActionBar的用法示例。


在下文中一共展示了ActionBar.LayoutParams方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addRightView

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
/**
 * 设置右边图标靠右,解决靠右时与设置中间标题的冲突
 *
 * @param v
 */
private void addRightView(View v) {
    final ViewGroup.LayoutParams vlp = v.getLayoutParams();
    final LayoutParams lp;
    if (vlp == null) {
        lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        lp.gravity = Gravity.RIGHT;
    } else if (!checkLayoutParams(vlp)) {
        if (vlp instanceof LayoutParams) {
            lp = new LayoutParams((LayoutParams) vlp);
        } else if (vlp instanceof ActionBar.LayoutParams) {
            lp = new LayoutParams((ActionBar.LayoutParams) vlp);
        } else if (vlp instanceof MarginLayoutParams) {
            lp = new LayoutParams((MarginLayoutParams) vlp);
        } else {
            lp = new LayoutParams(vlp);
        }
        lp.gravity = Gravity.RIGHT;
    } else {
        lp = (LayoutParams) vlp;
    }
    addView(v, lp);
}
 
开发者ID:forplane,项目名称:head,代码行数:28,代码来源:HeadToolBar.java

示例2: addStatusBar

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
/**
 * @return
 * @throws
 * @fuction 初始化并加载我们的状态栏背景,我们添加的这个背景,
 * 不是添加在Activit的布局中,而是Activity的contextFrameLayout中设置作为状态栏背景的View的属性
 * @parm
 */
@TargetApi(19)
@Override
public void addStatusBar() {
    if((request.isTrans()==request.isImageAsBg())) {
        Window window = request.getActivity().getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        ViewGroup.LayoutParams layoutParams =
                new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                        request.getStatusBarHeigth());
        addMyStatusView(layoutParams);
    }
}
 
开发者ID:ljh998,项目名称:BAStatusBarLib,代码行数:20,代码来源:AddBarAftreKiK.java

示例3: generateLayoutParams

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
/**
 * 创建{@link LayoutParams}
 * 用于指定添加到ToolBar的View的位置
 *
 * @param lp      view的LayoutParams
 * @param gravity CENTER,LEFT,RIGHT
 * @return LayoutParams
 */
private LayoutParams generateLayoutParams(ViewGroup.LayoutParams lp, int gravity) {
    LayoutParams layoutParams;
    if (lp instanceof LayoutParams) {
        layoutParams = new LayoutParams((LayoutParams) lp);
    } else if (lp instanceof ActionBar.LayoutParams) {
        layoutParams = new LayoutParams((ActionBar.LayoutParams) lp);
    } else if (lp instanceof MarginLayoutParams) {
        layoutParams = new LayoutParams((MarginLayoutParams) lp);
    } else {
        layoutParams = new LayoutParams(lp);
    }
    layoutParams.gravity = gravity;
    return layoutParams;
}
 
开发者ID:Gofar,项目名称:TitleBar,代码行数:23,代码来源:TitleBar.java

示例4: generateLayoutParams

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
    LayoutParams lp;
    if (p instanceof LayoutParams) {
        lp = new LayoutParams((LayoutParams) p);
    } else if (p instanceof ActionBar.LayoutParams) {
        lp = new LayoutParams((ActionBar.LayoutParams) p);
    } else if (p instanceof MarginLayoutParams) {
        lp = new LayoutParams((MarginLayoutParams) p);
    } else {
        lp = new LayoutParams(p);
    }
    lp.gravity = Gravity.CENTER;
    return lp;
}
 
开发者ID:forplane,项目名称:head,代码行数:16,代码来源:HeadToolBar.java

示例5: initview

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void initview() {
        if (mView == null) {
            mInflater = LayoutInflater.from(getContext());
            mView = mInflater.inflate(R.layout.toolbar, null);
            mLRippleView = (RippleView) mView.findViewById(R.id.more);
            mRRippleView = (RippleView) mView.findViewById(R.id.more1);
            toolbar_rightButton = (ImageView) mView.findViewById(R.id.id_btn_right);
            toolbar_title = (TextView) mView.findViewById(R.id.id_tv_title);
            toolbar_searchview = (EditText) mView.findViewById(R.id.id_et_search);
            toolbar_leftButton = (ImageView) mView.findViewById(R.id.id_ib_navigation);
            ActionBar.LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT);
            addView(mView, lp);
//            if (showSearchView) {
//                showSearchview();
//                hideTitle();
//            } else {
//                hideSearchview();
//                showTitle();
//                if (title != null) {
//                    toolbar_title.setText(title);
//                }
//            }
//            Log.d("left_button_icon", "initview:5"+left_button_icon);
//            if (left_button_icon != null) {
//
//                toolbar_leftButton.setBackground(left_button_icon);
//                toolbar_leftButton.setVisibility(VISIBLE);
//            }
//
//            if (right_button_icon != null) {
//                toolbar_rightButton.setImageDrawable(right_button_icon);
//                toolbar_rightButton.setVisibility(VISIBLE);
//            }

        }

    }
 
开发者ID:yiwent,项目名称:Mobike,代码行数:39,代码来源:MyToolBar.java

示例6: onCreateActionMode

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
        public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {


//            mSearchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.search_menu));
            mSearchView = new SearchView(getSupportActionBar().getThemedContext());
            ActionBar.LayoutParams params = new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT);
            mSearchView.setLayoutParams(params);
            mSearchView.setLayoutParams(new ActionBar.LayoutParams(Gravity.LEFT));
            mSearchView.setMaxWidth(Integer.MAX_VALUE);


//            mSearchView = new SearchView();


            setupSearchView(mSearchView);

            // search menu item
            MenuItem searchMenuItem = menu.add(Menu.NONE, Menu.NONE, 2, getString(R.string.menu_search));
            searchMenuItem.setIcon(R.drawable.search);
            searchMenuItem.expandActionView();
            MenuItemCompat.setActionView(searchMenuItem, mSearchView);
            MenuItemCompat.setShowAsAction(searchMenuItem, MenuItem.SHOW_AS_ACTION_ALWAYS);


            MenuItem searchMenuItem3 = menu.add(Menu.NONE, Menu.NONE, 1, getString(R.string.menu_search));
            searchMenuItem3.setIcon(R.drawable.search);
            MenuItemCompat.setActionView(searchMenuItem3, iv);
            MenuItemCompat.setShowAsAction(searchMenuItem3, MenuItem.SHOW_AS_ACTION_ALWAYS);


            return true;
        }
 
开发者ID:Elbehiry,项目名称:Viajes,代码行数:34,代码来源:MainActivity.java


注:本文中的android.support.v7.app.ActionBar.LayoutParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。