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


Java ConstraintLayout.LayoutParams方法代码示例

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


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

示例1: bind

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
public void bind(final Item item) {
    mTextLabel.setText(item.getLabel());
    ConstraintLayout.LayoutParams layoutParamsTextLabel = (ConstraintLayout.LayoutParams) mTextLabel.getLayoutParams();
    if (item.getPercent() > LABEL_POSITION_CHANGE_PERCENT) {
        // move label above guideline
        layoutParamsTextLabel.bottomToTop = mGuidelineTop.getId();
        layoutParamsTextLabel.topToTop = -1;
        layoutParamsTextLabel.bottomMargin = mLabelMargin;
        layoutParamsTextLabel.topMargin = 0;

    } else {
        // move label below guideline
        layoutParamsTextLabel.topToTop = mGuidelineTop.getId();
        layoutParamsTextLabel.bottomToTop = -1;
        layoutParamsTextLabel.bottomMargin = 0;
        layoutParamsTextLabel.topMargin = mLabelMargin;
    }
    mTextLabel.setLayoutParams(layoutParamsTextLabel);

    ConstraintLayout.LayoutParams layoutParamsGuideline = (ConstraintLayout.LayoutParams) mGuidelineTop.getLayoutParams();
    layoutParamsGuideline.guidePercent = item.getPercent();
    mGuidelineTop.setLayoutParams(layoutParamsGuideline);

}
 
开发者ID:DroidsOnRoids,项目名称:constraint-layout-charts,代码行数:25,代码来源:ChartsViewHolder.java

示例2: onResume

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    if (getUserVisibleHint()) {
        if (getView() != null) {
            swipeRefreshLayout = getView().findViewById(R.id.swipe_refresh_layout);
        }
    }
    if (swipeRefreshLayout != null) {
        swipeRefreshLayout.setOnRefreshListener(this);
    }
    AppBarLayout appBar = getActivity().findViewById(R.id.appbar);
    if (appBar != null) {
        Guideline guideTopInfo = getView().findViewById(R.id.guideline);
        ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) guideTopInfo.getLayoutParams();
        params.guidePercent = .45f;
        guideTopInfo.setLayoutParams(params);
    }
    refreshHandler.post(refreshRunnable);
}
 
开发者ID:alvinhkh,项目名称:buseta,代码行数:21,代码来源:LwbStopListFragment.java

示例3: adjustBannerTextVerticalBias

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
/**
 * Adjust the banner text layout {@link ConstraintLayout} vertical bias.
 *
 * @param percentBias to be set to the text layout
 */
private void adjustBannerTextVerticalBias(float percentBias) {
  int orientation = getContext().getResources().getConfiguration().orientation;
  if (orientation == Configuration.ORIENTATION_PORTRAIT) {
    ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) instructionLayoutText.getLayoutParams();
    params.verticalBias = percentBias;
    instructionLayoutText.setLayoutParams(params);
  }
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:14,代码来源:InstructionView.java

示例4: adjustBannerTextVerticalBias

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
/**
 * Adjust the banner text layout {@link ConstraintLayout} vertical bias.
 *
 * @param percentBias to be set to the text layout
 */
private void adjustBannerTextVerticalBias(InstructionViewHolder holder, float percentBias) {
  int orientation = holder.itemView.getResources().getConfiguration().orientation;
  if (orientation == Configuration.ORIENTATION_PORTRAIT) {
    ConstraintLayout.LayoutParams params =
      (ConstraintLayout.LayoutParams) holder.instructionLayoutText.getLayoutParams();
    params.verticalBias = percentBias;
    holder.instructionLayoutText.setLayoutParams(params);
  }
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:15,代码来源:InstructionListAdapter.java

示例5: startColorParams

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
private static ConstraintLayout.LayoutParams startColorParams(View selectedView) {
    final int colorSize = selectedView.getContext().getResources()
            .getDimensionPixelOffset(R.dimen.product_color_size);

    final ConstraintLayout.LayoutParams layoutParams =
            new ConstraintLayout.LayoutParams(colorSize, colorSize);

    setStartState(selectedView, layoutParams);
    return layoutParams;
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:11,代码来源:OrderDialogFragment.java

示例6: startTextParams

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
private static ConstraintLayout.LayoutParams startTextParams(View selectedView) {
    final ConstraintLayout.LayoutParams layoutParams =
            new ConstraintLayout.LayoutParams(
                    ViewGroup.LayoutParams.WRAP_CONTENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT);

    setStartState(selectedView, layoutParams);
    return layoutParams;
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:10,代码来源:OrderDialogFragment.java

示例7: endParams

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
private static ConstraintLayout.LayoutParams endParams(View v, View targetView) {
    final ConstraintLayout.LayoutParams layoutParams =
            (ConstraintLayout.LayoutParams) v.getLayoutParams();

    final int marginLeft = v.getContext().getResources()
            .getDimensionPixelOffset(R.dimen.spacing_medium);

    layoutParams.setMargins(marginLeft, 0, 0, 0);
    layoutParams.topToTop = targetView.getId();
    layoutParams.startToEnd = targetView.getId();
    layoutParams.bottomToBottom = targetView.getId();

    return layoutParams;
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:15,代码来源:OrderDialogFragment.java

示例8: foldStuff

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
private void foldStuff(){
    caption.setTextSize(TypedValue.COMPLEX_UNIT_PX,caption.getTextSize()/2f);
    caption.setTextColor(Color.WHITE);
    ConstraintLayout.LayoutParams params=getParams();
    params.rightToRight=ConstraintLayout.LayoutParams.UNSET;
    params.verticalBias=0.5f;
    caption.setLayoutParams(params);
}
 
开发者ID:vpaliyX,项目名称:LoginConcept,代码行数:9,代码来源:SignUpFragment.java

示例9: startColorParams

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
private static ConstraintLayout.LayoutParams startColorParams(View selectedView) {
    final int colorSize = selectedView.getContext().getResources()
        .getDimensionPixelOffset(R.dimen.product_color_size);

    final ConstraintLayout.LayoutParams layoutParams =
        new ConstraintLayout.LayoutParams(colorSize, colorSize);

    setStartState(selectedView, layoutParams);
    return layoutParams;
}
 
开发者ID:saulmm,项目名称:From-design-to-Android-part1,代码行数:11,代码来源:OrderDialogFragment.java

示例10: startTextParams

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
private static ConstraintLayout.LayoutParams startTextParams(View selectedView) {
    final ConstraintLayout.LayoutParams layoutParams =
        new ConstraintLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);

    setStartState(selectedView, layoutParams);
    return layoutParams;
}
 
开发者ID:saulmm,项目名称:From-design-to-Android-part1,代码行数:10,代码来源:OrderDialogFragment.java

示例11: endParams

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
private static ConstraintLayout.LayoutParams endParams(View v, View targetView) {
    final ConstraintLayout.LayoutParams layoutParams =
        (ConstraintLayout.LayoutParams) v.getLayoutParams();

    final int marginLeft = v.getContext().getResources()
        .getDimensionPixelOffset(R.dimen.spacing_medium);

    layoutParams.setMargins(marginLeft, 0, 0, 0);
    layoutParams.topToTop = targetView.getId();
    layoutParams.startToEnd = targetView.getId();
    layoutParams.bottomToBottom = targetView.getId();

    return layoutParams;
}
 
开发者ID:saulmm,项目名称:From-design-to-Android-part1,代码行数:15,代码来源:OrderDialogFragment.java

示例12: initGuideLine

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
private void initGuideLine() {
    ConstraintLayout.LayoutParams lp = (ConstraintLayout.LayoutParams) topGuide.getLayoutParams();
    lp.guidePercent = isHalloween ? 0.34f : 0.3f;
    topGuide.setLayoutParams(lp);
}
 
开发者ID:appwise-labs,项目名称:NoInternetDialog,代码行数:6,代码来源:NoInternetDialog.java

示例13: setStartState

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
private static void setStartState(View selectedView, ConstraintLayout.LayoutParams layoutParams) {
    layoutParams.topToTop = ((ViewGroup) selectedView.getParent().getParent()).getId();
    layoutParams.leftToLeft = ((ViewGroup) selectedView.getParent().getParent()).getId();
    layoutParams.setMargins((int) selectedView.getX(), (int) selectedView.getY(), 0, 0);
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:6,代码来源:OrderDialogFragment.java

示例14: getParams

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
protected ConstraintLayout.LayoutParams getParams(){
    return ConstraintLayout.LayoutParams.class.cast(caption.getLayoutParams());
}
 
开发者ID:vpaliyX,项目名称:LoginConcept,代码行数:4,代码来源:AuthFragment.java

示例15: generateLayoutParams

import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
@Override
public ConstraintLayout.LayoutParams generateLayoutParams(
        AttributeSet attrs) {
    return new LayoutParams(getContext(), attrs);
}
 
开发者ID:StylingAndroid,项目名称:PresenterLite,代码行数:6,代码来源:ConstraintSlideLayout.java


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