当前位置: 首页>>代码示例>>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;未经允许,请勿转载。