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


Java ViewGroup.getLayoutParams方法代码示例

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


在下文中一共展示了ViewGroup.getLayoutParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onMeasure

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    /**
     * 显示的设置一个宽度
     */
    if (!once) {
        LinearLayout wrapper = (LinearLayout) getChildAt(0);
        mMenu = (ViewGroup) wrapper.getChildAt(0);
        mContent = (ViewGroup) wrapper.getChildAt(1);

        mMenuWidth = mScreenWidth - mMenuRightPadding;
        mThirdMenuWidth = mMenuWidth / 3;
        mMenu.getLayoutParams().width = mMenuWidth;
        mContent.getLayoutParams().width = mScreenWidth;

    }
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:SlidingMenu.java

示例3: onCreateViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * @param parent views container
 * @param type   value of VIEW_TYPES
 * @return the viewHolder for the specified type
 */
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int type) {
    View itemLayoutView;
    if (type == VIEW_TYPES.NORMAL) {
        return onCreateNormalHolder(parent);
    } else if (type >= VIEW_TYPES.HEADER) {
        itemLayoutView = headers.get(type - VIEW_TYPES.HEADER);
        TrueUtils.removeParent(itemLayoutView);
        itemLayoutView.setLayoutParams(parent.getLayoutParams());
        return onCreateHeaderHolder(itemLayoutView, parent);
    } else if (type <= VIEW_TYPES.FOOTER) {
        itemLayoutView = footers.get(type - VIEW_TYPES.FOOTER);
        TrueUtils.removeParent(itemLayoutView);
        ViewGroup.LayoutParams lp = parent.getLayoutParams();
        lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        itemLayoutView.setLayoutParams(lp);
        return onCreateFooterHolder(itemLayoutView, parent);
    } else return onCreateOtherHolder(parent, type);
}
 
开发者ID:jaksab,项目名称:TrueRecyclerAdapter,代码行数:25,代码来源:TrueRecyclerAdapter.java

示例4: onMeasure

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    /**
     * 显示的设置一个宽度
     */
    if (!once) {
        LinearLayout wrapper = (LinearLayout) getChildAt(0);
        mMenu = (ViewGroup) wrapper.getChildAt(0);
        mContent = (ViewGroup) wrapper.getChildAt(1);

        mMenuWidth = mScreenWidth - mMenuRightPadding;
        mHalfMenuWidth = mMenuWidth / 2;
        mMenu.getLayoutParams().width = mMenuWidth;
        mContent.getLayoutParams().width = mScreenWidth;

    }
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);

}
 
开发者ID:Jusenr,项目名称:androidgithub,代码行数:20,代码来源:PTSlidingMenu.java

示例5: onMeasure

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * 设置子View和自己的宽和高
 * @param widthMeasureSpec
 * @param heightMeasureSpec
 */
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    if (!mMeasureOnce) {
        //初始化控件
        mWapper =(LinearLayout)getChildAt(0);
        mMenu = (ViewGroup)mWapper.getChildAt(0);
        mContent =(ViewGroup)mWapper.getChildAt(1);
        mMenuWidth = mScreenWidth - mMenuRightPadding;
        mMenu.getLayoutParams().width = mMenuWidth;
        mContent.getLayoutParams().width = mScreenWidth;

        //mCanScrollArea = getMeasuredWidth()/5;
        mCanScrollArea = 40;
    }
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);

}
 
开发者ID:zongkaili,项目名称:MenuSet,代码行数:23,代码来源:SlideMenu.java

示例6: onWidgetsBound

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected void onWidgetsBound() {
    List<WidgetItem> widgets = mLauncher.getWidgetsForPackageUser(new PackageUserKey(
            mOriginalItemInfo.getTargetComponent().getPackageName(), mOriginalItemInfo.user));

    ViewGroup widgetRow = (ViewGroup) findViewById(R.id.widgets);
    ViewGroup widgetCells = (ViewGroup) widgetRow.findViewById(R.id.widgets_cell_list);

    widgetCells.removeAllViews();

    for (int i = 0; i < widgets.size(); i++) {
        WidgetCell widget = addItemCell(widgetCells);
        widget.applyFromCellItem(widgets.get(i), LauncherAppState.getInstance(mLauncher)
                .getWidgetCache());
        widget.ensurePreview();
        widget.setVisibility(View.VISIBLE);
        if (i < widgets.size() - 1) {
            addDivider(widgetCells);
        }
    }

    if (widgets.size() == 1) {
        // If there is only one widget, we want to center it instead of left-align.
        WidgetsBottomSheet.LayoutParams params = (WidgetsBottomSheet.LayoutParams)
                widgetRow.getLayoutParams();
        params.gravity = Gravity.CENTER_HORIZONTAL;
    } else {
        // Otherwise, add an empty view to the start as padding (but still scroll edge to edge).
        View leftPaddingView = LayoutInflater.from(getContext()).inflate(
                R.layout.widget_list_divider, widgetRow, false);
        leftPaddingView.getLayoutParams().width = Utilities.pxFromDp(
                16, getResources().getDisplayMetrics());
        widgetCells.addView(leftPaddingView, 0);
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:36,代码来源:WidgetsBottomSheet.java

示例7: remove

import android.view.ViewGroup; //导入方法依赖的package包/类
public void remove() {
    if (getParent() == null || _labelViewContainerID == -1) {
        return;
    }

    ViewGroup frameContainer = (ViewGroup) getParent();
    assert (frameContainer.getChildCount() == 2);
    View target = frameContainer.getChildAt(0);

    ViewGroup parentContainer = (ViewGroup) frameContainer.getParent();
    int groupIndex = parentContainer.indexOfChild(frameContainer);
    if (frameContainer.getParent() instanceof RelativeLayout) {
        for (int i = 0; i < parentContainer.getChildCount(); i++) {
            if (i == groupIndex) {
                continue;
            }
            View view = parentContainer.getChildAt(i);
            RelativeLayout.LayoutParams para = (RelativeLayout.LayoutParams) view.getLayoutParams();
            for (int j = 0; j < para.getRules().length; j++) {
                if (para.getRules()[j] == _labelViewContainerID) {
                    para.getRules()[j] = target.getId();
                }
            }
            view.setLayoutParams(para);
        }
    }

    ViewGroup.LayoutParams frameLayoutParam = frameContainer.getLayoutParams();
    target.setLayoutParams(frameLayoutParam);
    parentContainer.removeViewAt(groupIndex);
    frameContainer.removeView(target);
    frameContainer.removeView(this);
    parentContainer.addView(target,groupIndex);
    _labelViewContainerID = -1;
}
 
开发者ID:open-android,项目名称:labelview,代码行数:36,代码来源:LabelView.java

示例8: initAyahActionPanel

import android.view.ViewGroup; //导入方法依赖的package包/类
private void initAyahActionPanel() {
  slidingPanel = (SlidingUpPanelLayout) findViewById(R.id.sliding_panel);
  final ViewGroup slidingLayout =
      (ViewGroup) slidingPanel.findViewById(R.id.sliding_layout);
  slidingPager = (ViewPager) slidingPanel
      .findViewById(R.id.sliding_layout_pager);
  final IconPageIndicator slidingPageIndicator =
      (IconPageIndicator) slidingPanel
          .findViewById(R.id.sliding_pager_indicator);

  // Find close button and set listener
  final View closeButton = slidingPanel
      .findViewById(R.id.sliding_menu_close);
  closeButton.setOnClickListener(v -> endAyahMode());

  // Create and set fragment pager adapter
  slidingPagerAdapter = new SlidingPagerAdapter(getSupportFragmentManager(),
      Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 &&
          (quranSettings.isArabicNames() || QuranUtils.isRtl()));
  slidingPager.setAdapter(slidingPagerAdapter);

  // Attach the view pager to the action bar
  slidingPageIndicator.setViewPager(slidingPager);

  // Set sliding layout parameters
  int displayHeight = getResources().getDisplayMetrics().heightPixels;
  slidingLayout.getLayoutParams().height =
      (int) (displayHeight * PANEL_MAX_HEIGHT);
  slidingPanel.setEnableDragViewTouchEvents(true);
  slidingPanel.setPanelSlideListener(new SlidingPanelListener());
  slidingLayout.setVisibility(View.GONE);

  // When clicking any menu items, expand the panel
  slidingPageIndicator.setOnClickListener(v -> {
    if (!slidingPanel.isExpanded()) {
      slidingPanel.expandPane();
    }
  });
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:40,代码来源:PagerActivity.java

示例9: onCreateViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    ViewGroup v = (ViewGroup) mInflater.inflate(R.layout.video_view_container, parent, false);
    v.getLayoutParams().width = mItemWidth;
    v.getLayoutParams().height = mItemHeight;
    mDefaultChildItem = v.getChildCount();
    return new VideoUserStatusHolder(v);
}
 
开发者ID:AgoraIO,项目名称:OpenVideoCall-Android,代码行数:9,代码来源:VideoViewAdapter.java

示例10: initView

import android.view.ViewGroup; //导入方法依赖的package包/类
private void initView() {
    LayoutInflater layoutInflater = getLayoutInflater();
    mListContainer = (HorizontalScrollViewEx1) findViewById(R.id.container);
    int screenWidth = MyUtil.getScreenMetrics(this).widthPixels;
    for (int i = 0; i < 3; i++) {
        ViewGroup layout = (ViewGroup) layoutInflater.inflate(R.layout.content_layout1, mListContainer, false);
        layout.getLayoutParams().width = screenWidth;
        TextView textView = (TextView) layout.findViewById(R.id.title);
        textView.setText("page " + (i + 1));
        layout.setBackgroundColor(Color.rgb(255 / (i + 1), 255 / (i + 1), 0));
        createList(layout);
        mListContainer.addView(layout);
    }
}
 
开发者ID:DysaniazzZ,项目名称:ArtOfAndroid,代码行数:15,代码来源:Demo1Activity.java

示例11: initView

import android.view.ViewGroup; //导入方法依赖的package包/类
private void initView() {
    LayoutInflater layoutInflater = getLayoutInflater();
    mListContainer = (HorizontalScrollViewEx2) findViewById(R.id.container);
    int screenWidth = MyUtil.getScreenMetrics(this).widthPixels;
    for (int i = 0; i < 3; i++) {
        ViewGroup layout = (ViewGroup) layoutInflater.inflate(R.layout.content_layout2, mListContainer, false);
        layout.getLayoutParams().width = screenWidth;
        TextView textView = (TextView) layout.findViewById(R.id.title);
        textView.setText("page " + (i + 1));
        textView.setBackgroundColor(Color.rgb(255 / (i + 1), 255 / (i + 1), 0));
        createList(layout);
        mListContainer.addView(layout);
    }
}
 
开发者ID:DysaniazzZ,项目名称:ArtOfAndroid,代码行数:15,代码来源:Demo2Activity.java

示例12: 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

示例13: onMeasure

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * 将记录的值设置到控件上,并只让控件设置一次
 * @param widthMeasureSpec
 * @param heightMeasureSpec
 */
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    if(!isonce) {
        mParentView = (LinearLayout) this.getChildAt(0);
        mTopView = (ViewGroup) mParentView.getChildAt(0);
        mTopView.getLayoutParams().height = mTopViewHeight;
        isonce=true;
    }
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:16,代码来源:PullToZoomScrollView.java

示例14: BoxViewHolder

import android.view.ViewGroup; //导入方法依赖的package包/类
public BoxViewHolder(ViewGroup parent) {
    super(new CustomBaseCardview(parent.getContext()));
    mCard = (BaseCardView)view;
    mCard.setFocusable(true);
    mCard.setFocusableInTouchMode(true);

    mRoot = (ViewGroup)LayoutInflater.from(parent.getContext()).inflate(R.layout.leanback_box, mCard, false);
    mImageViewContainer = (ViewGroup)mRoot.findViewById(R.id.image_container);
    mImageView = (ImageView)mImageViewContainer.findViewById(R.id.image);
    mTextView = (TextView)mRoot.findViewById(R.id.name);

    BaseCardView.LayoutParams lp = new BaseCardView.LayoutParams(mRoot.getLayoutParams());
    lp.viewType = BaseCardView.LayoutParams.VIEW_TYPE_MAIN;
    mCard.addView(mRoot);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:16,代码来源:BoxItemPresenter.java

示例15: setupCustomContent

import android.view.ViewGroup; //导入方法依赖的package包/类
private void setupCustomContent(ViewGroup customPanel) {
    View customView;
    boolean hasCustomView = false;
    if (this.mView != null) {
        customView = this.mView;
    } else if (this.mViewLayoutResId != 0) {
        customView = LayoutInflater.from(this.mContext).inflate(this.mViewLayoutResId, customPanel, false);
    } else {
        customView = null;
    }
    if (customView != null) {
        hasCustomView = true;
    }
    if (!(hasCustomView && canTextInput(customView))) {
        this.mWindow.setFlags(131072, 131072);
    }
    if (hasCustomView) {
        FrameLayout custom = (FrameLayout) this.mWindow.findViewById(R.id.custom);
        custom.addView(customView, new LayoutParams(-1, -1));
        if (this.mViewSpacingSpecified) {
            custom.setPadding(this.mViewSpacingLeft, this.mViewSpacingTop, this.mViewSpacingRight, this.mViewSpacingBottom);
        }
        if (this.mListView != null) {
            ((LinearLayout.LayoutParams) customPanel.getLayoutParams()).weight = 0.0f;
            return;
        }
        return;
    }
    customPanel.setVisibility(8);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:31,代码来源:AlertController.java


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