當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewGroup.setLayoutParams方法代碼示例

本文整理匯總了Java中android.view.ViewGroup.setLayoutParams方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewGroup.setLayoutParams方法的具體用法?Java ViewGroup.setLayoutParams怎麽用?Java ViewGroup.setLayoutParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.ViewGroup的用法示例。


在下文中一共展示了ViewGroup.setLayoutParams方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setStatusBarTransparent

import android.view.ViewGroup; //導入方法依賴的package包/類
@SuppressLint({"NewApi"})
private void setStatusBarTransparent(String titleResId) {
    ViewGroup title = (ViewGroup) this.mRootView.findViewWithTag(titleResId);
    if (VERSION.SDK_INT >= 19) {
        getWindow().getDecorView().setSystemUiVisibility(1280);
        getWindow().addFlags(67108864);
        if (title != null) {
            LayoutParams lp = title.getLayoutParams();
            lp.height = dip2px(72.0f);
            title.setLayoutParams(lp);
            RelativeLayout back = (RelativeLayout) this.mRootView.findViewWithTag("umgr_title_back_layout");
            RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams) back.getLayoutParams();
            rlp.topMargin = dip2px(24.0f);
            back.setLayoutParams(rlp);
            RelativeLayout t = (RelativeLayout) this.mRootView.findViewWithTag("umgr_title_tv_layout");
            RelativeLayout.LayoutParams rrlp = (RelativeLayout.LayoutParams) t.getLayoutParams();
            rrlp.topMargin = dip2px(24.0f);
            t.setLayoutParams(rrlp);
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:22,代碼來源:BasicActivity.java

示例2: configureCard

import android.view.ViewGroup; //導入方法依賴的package包/類
private void configureCard(ViewGroup card) {
    cardContent.setMaxWidth(getCardWidth());
    cardContent.setPadding(
            CARD_PADDING_VERTICAL,
            CARD_PADDING_HORIZONTAL,
            CARD_PADDING_VERTICAL,
            CARD_PADDING_HORIZONTAL
    );
    cardContent.setLayoutParams(new FrameLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT
    ));

    card.setBackgroundResource(getCardBackgroundDrawable());
    card.addView(cardContent);

    FrameLayout.LayoutParams cardLayoutParams = generateDefaultLayoutParams();
    cardLayoutParams.width = LayoutParams.WRAP_CONTENT;
    cardLayoutParams.height = LayoutParams.WRAP_CONTENT;
    cardLayoutParams.gravity = getCardGravity();
    cardLayoutParams.leftMargin = getCardMarginLeft();
    cardLayoutParams.topMargin = getCardMarginTop();
    cardLayoutParams.rightMargin = getCardMarginRight();
    cardLayoutParams.bottomMargin = getCardMarginBottom();
    card.setLayoutParams(cardLayoutParams);
}
 
開發者ID:dimorinny,項目名稱:show-case-card-view,代碼行數:27,代碼來源:ShowCaseView.java

示例3: addToggleItemView

import android.view.ViewGroup; //導入方法依賴的package包/類
private SwitchButton addToggleItemView(String key, int titleResId, boolean initState) {
    ViewGroup vp = (ViewGroup) getLayoutInflater().inflate(R.layout.nim_user_profile_toggle_item, null);
    ViewGroup.LayoutParams vlp = new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, (int) getResources().getDimension(R.dimen.isetting_item_height));
    vp.setLayoutParams(vlp);

    TextView titleText = ((TextView) vp.findViewById(R.id.user_profile_title));
    titleText.setText(titleResId);

    SwitchButton switchButton = (SwitchButton) vp.findViewById(R.id.user_profile_toggle);
    switchButton.setCheck(initState);
    switchButton.setOnChangedListener(onChangedListener);
    switchButton.setTag(key);

    toggleLayout.addView(vp);

    if (toggleStateMap == null) {
        toggleStateMap = new HashMap<>();
    }
    toggleStateMap.put(key, initState);
    return switchButton;
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:23,代碼來源:UserProfileActivity.java

示例4: addToggleItemView

import android.view.ViewGroup; //導入方法依賴的package包/類
private SwitchButton addToggleItemView(String key, int titleResId, boolean initState) {
    ViewGroup vp = (ViewGroup) getLayoutInflater().inflate(R.layout.nim_user_profile_toggle_item, null);
    ViewGroup.LayoutParams vlp = new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, (int) getResources().getDimension(R.dimen.isetting_item_height));
    vp.setLayoutParams(vlp);

    TextView titleText = ((TextView) vp.findViewById(R.id.user_profile_title));
    titleText.setText(titleResId);

    SwitchButton switchButton = (SwitchButton) vp.findViewById(R.id.user_profile_toggle);
    switchButton.setCheck(initState);
    switchButton.setOnChangedListener(onChangedListener);
    switchButton.setTag(key);

    toggleLayout.addView(vp);

    return switchButton;
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:19,代碼來源:NormalTeamInfoActivity.java

示例5: initViews

import android.view.ViewGroup; //導入方法依賴的package包/類
protected void initViews() {
    LayoutInflater layoutInflater = LayoutInflater.from(context);
    decorView = (ViewGroup) ((Activity) context).getWindow().getDecorView().findViewById(android.R.id.content);
    rootView = (ViewGroup) layoutInflater.inflate(R.layout.time_picker_base, decorView, false);
    rootView.setLayoutParams(new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
    ));
    contentContainer = (ViewGroup) rootView.findViewById(R.id.content_container);
    contentContainer.setLayoutParams(params);
}
 
開發者ID:wmuqing,項目名稱:timePicker,代碼行數:11,代碼來源:BasePickerView.java

示例6: initViews

import android.view.ViewGroup; //導入方法依賴的package包/類
protected void initViews(){
    Context context = contextWeak.get();
    if(context == null) return;
    LayoutInflater layoutInflater = LayoutInflater.from(context);
    decorView = (ViewGroup) ((Activity)context).getWindow().getDecorView().findViewById(android.R.id.content);
    rootView = (ViewGroup) layoutInflater.inflate(R.layout.layout_alertview, decorView, false);
    rootView.setLayoutParams(new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
    ));
    contentContainer = (ViewGroup) rootView.findViewById(R.id.content_container);
    int margin_alert_left_right = 0;
    switch (style){
        case ActionSheet:
            params.gravity = Gravity.BOTTOM;
            margin_alert_left_right = context.getResources().getDimensionPixelSize(R.dimen.margin_actionsheet_left_right);
            params.setMargins(margin_alert_left_right,0,margin_alert_left_right,margin_alert_left_right);
            contentContainer.setLayoutParams(params);
            gravity = Gravity.BOTTOM;
            //contentContainer.setBackgroundColor(context.getResources().getColor(R.color.color_Background));
            initActionSheetViews(layoutInflater);
            break;
        case Alert:
            params.gravity = Gravity.CENTER;
            margin_alert_left_right = context.getResources().getDimensionPixelSize(R.dimen.margin_alert_left_right);
            params.setMargins(margin_alert_left_right,0,margin_alert_left_right,0);
            contentContainer.setLayoutParams(params);
            gravity = Gravity.CENTER;
            initAlertViews(layoutInflater);
            break;
    }
}
 
開發者ID:AppHero2,項目名稱:Raffler-Android,代碼行數:32,代碼來源:AlertView.java

示例7: setFullscreenManager

import android.view.ViewGroup; //導入方法依賴的package包/類
/**
 * @param manager The fullscreen manager that should be notified of changes to this tab (if
 *                set to null, no more updates will come from this tab).
 */
public void setFullscreenManager(FullscreenManager manager) {
    mFullscreenManager = manager;
    if (mFullscreenManager != null) {
        boolean topOffsetsInitialized = !Float.isNaN(mPreviousTopControlsOffsetY)
                && !Float.isNaN(mPreviousContentOffsetY);
        boolean bottomOffsetsInitialized =
                !Float.isNaN(mPreviousBottomControlsOffsetY);
        boolean isChromeHomeEnabled = FeatureUtilities.isChromeHomeEnabled();

        // Make sure the dominant control offsets have been set.
        if ((!topOffsetsInitialized && !isChromeHomeEnabled)
                || (!bottomOffsetsInitialized && isChromeHomeEnabled)) {
            mFullscreenManager.setPositionsForTabToNonFullscreen();
        } else {
            mFullscreenManager.setPositionsForTab(mPreviousTopControlsOffsetY,
                    mPreviousBottomControlsOffsetY,
                    mPreviousContentOffsetY);
        }
        updateFullscreenEnabledState();
    }

    // For blimp mode, offset the blimp view by the height of browser controls. This will ensure
    // that the view doesn't get clipped at the bottom of the page and also the touch offsets
    // would work correctly.
    if (getBlimpContents() != null && mFullscreenManager != null) {
        ViewGroup blimpView = getBlimpContents().getView();
        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) blimpView.getLayoutParams();
        if (lp == null) {
            lp = new FrameLayout.LayoutParams(
                    LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        }

        lp.topMargin = mFullscreenManager.getTopControlsHeight();
        blimpView.setLayoutParams(lp);
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:41,代碼來源:Tab.java

示例8: BaseNetChangeLayer

import android.view.ViewGroup; //導入方法依賴的package包/類
public BaseNetChangeLayer(Context context, ViewGroup parent) {
    if (HotFix.PREVENT_VERIFY) {
        System.out.println(VerifyLoad.class);
    }
    if (context == null || parent == null) {
        throw new RuntimeException("context or parent cann't be null");
    }
    this.parent = parent;
    this.mContext = context;
    this.netRoot = LayoutInflater.from(context).inflate(R.layout.net_change_layout, null, false);
    if (parent instanceof RelativeLayout) {
        this.netRoot.setLayoutParams(new LayoutParams(-1, -1));
    }
    parent.addView(this.netRoot);
    if (parent instanceof AbsListView) {
        parent.setLayoutParams(new AbsListView.LayoutParams(-1, -1));
    }
    LogInfo.log("3_g", getClass().getSimpleName() + "--------------addView netRoot = " + this.netRoot + " , parent = " + parent);
    this.bind = true;
    this.net_change_text1 = (TextView) this.netRoot.findViewById(R.id.net_change_text1);
    this.net_change_text2 = this.netRoot.findViewById(R.id.net_change_text2);
    this.net_change_continue = (Button) this.netRoot.findViewById(R.id.net_change_continue);
    this.net_top_back = (ImageView) this.netRoot.findViewById(R.id.net_top_back);
    this.net_full_half = (ImageView) this.netRoot.findViewById(R.id.net_full_half);
    this.net_top_title = (TextView) this.netRoot.findViewById(R.id.net_top_title);
    this.net_top_back_r = (ImageView) this.netRoot.findViewById(R.id.net_top_back_r);
    this.net_top_title_r = (TextView) this.netRoot.findViewById(R.id.net_top_title_r);
    this.net_top_layout = this.netRoot.findViewById(R.id.net_top_layout);
    this.net_top_layout_r = this.netRoot.findViewById(R.id.net_top_r_layout);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:31,代碼來源:BaseNetChangeLayer.java

示例9: initViews

import android.view.ViewGroup; //導入方法依賴的package包/類
protected void initViews() {
    LayoutInflater layoutInflater = LayoutInflater.from(context);
    decorView = (ViewGroup) ((Activity) context).getWindow().getDecorView().findViewById(android.R.id.content);
    rootView = (ViewGroup) layoutInflater.inflate(R.layout.layout_basepickerview, decorView, false);
    rootView.setLayoutParams(new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
    ));
    contentContainer = (ViewGroup) rootView.findViewById(R.id.content_container);
    contentContainer.setLayoutParams(params);
}
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:11,代碼來源:BasePickerView.java

示例10: initViews

import android.view.ViewGroup; //導入方法依賴的package包/類
protected void initViews(){
    Context context = contextWeak.get();
    if(context == null) return;
    LayoutInflater layoutInflater = LayoutInflater.from(context);
    decorView = (ViewGroup) ((Activity)context).getWindow().getDecorView().findViewById(android.R.id.content);
    rootView = (ViewGroup) layoutInflater.inflate(R.layout.layout_alertview, decorView, false);
    rootView.setLayoutParams(new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
    ));
    contentContainer = (ViewGroup) rootView.findViewById(R.id.content_container);
    int margin_alert_left_right = 0;
    switch (style){
        case ActionSheet:
            params.gravity = Gravity.BOTTOM;
            margin_alert_left_right = context.getResources().getDimensionPixelSize(R.dimen.margin_actionsheet_left_right);
            params.setMargins(margin_alert_left_right,0,margin_alert_left_right,margin_alert_left_right);
            contentContainer.setLayoutParams(params);
            gravity = Gravity.BOTTOM;
            initActionSheetViews(layoutInflater);
            break;
        case Alert:
            params.gravity = Gravity.CENTER;
            margin_alert_left_right = context.getResources().getDimensionPixelSize(R.dimen.margin_alert_left_right);
            params.setMargins(margin_alert_left_right,0,margin_alert_left_right,0);
            contentContainer.setLayoutParams(params);
            gravity = Gravity.CENTER;
            initAlertViews(layoutInflater);
            break;
    }
}
 
開發者ID:devzwy,項目名稱:NeiHanDuanZiTV,代碼行數:31,代碼來源:AlertView.java

示例11: initView

import android.view.ViewGroup; //導入方法依賴的package包/類
private void initView(Context context) {
    mContext = context;
    ViewGroup moreView = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.xrefreshview_footer, this);
    moreView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    mContentView = moreView.findViewById(R.id.xrefreshview_footer_content);
    mProgressBar = moreView
            .findViewById(R.id.xrefreshview_footer_progressbar);
    mHintView = (TextView) moreView
            .findViewById(R.id.xrefreshview_footer_hint_textview);
    mClickView = (TextView) moreView
            .findViewById(R.id.xrefreshview_footer_click_textview);
}
 
開發者ID:LonelyMushroom,項目名稱:aarLibrary,代碼行數:14,代碼來源:XRefreshViewFooter.java

示例12: initView

import android.view.ViewGroup; //導入方法依賴的package包/類
private void initView(Context context) {
    mContext = context;
    ViewGroup moreView = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.rfv_footer, this);
    moreView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    lytFooter = moreView.findViewById(R.id.lytFooter);
    mProgressBar = moreView.findViewById(R.id.rfv_footer_progressbar);
    tvLoadState = (TextView) moreView.findViewById(R.id.tvLoadState);
    tvReleaseToLoadMore = (TextView) moreView.findViewById(R.id.tvReleaseToLoadMore);
}
 
開發者ID:Implementist,項目名稱:iReading,代碼行數:11,代碼來源:RefreshViewFooter.java


注:本文中的android.view.ViewGroup.setLayoutParams方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。