本文整理汇总了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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例14: getParams
import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
protected ConstraintLayout.LayoutParams getParams(){
return ConstraintLayout.LayoutParams.class.cast(caption.getLayoutParams());
}
示例15: generateLayoutParams
import android.support.constraint.ConstraintLayout; //导入方法依赖的package包/类
@Override
public ConstraintLayout.LayoutParams generateLayoutParams(
AttributeSet attrs) {
return new LayoutParams(getContext(), attrs);
}