當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。