當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。