本文整理匯總了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);
}