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


Java CSSNode类代码示例

本文整理汇总了Java中com.facebook.csslayout.CSSNode的典型用法代码示例。如果您正苦于以下问题:Java CSSNode类的具体用法?Java CSSNode怎么用?Java CSSNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: measureChildNode

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
private void measureChildNode(int widthMeasureSpec, int heightMeasureSpec) {
    int childNodeViewsCount = mChildNodeViews.size();
    for (int i = 0; i < childNodeViewsCount; i++) {
        UDView nodeView = mChildNodeViews.get(i);
        View view = nodeView.getView();
        CSSNode node = nodeView.getCssNode();

        if (node.getSizeToFit()) {
            int margins = (int) (node.getMargin().get(Spacing.LEFT) + node.getMargin().get(Spacing.RIGHT));
            measureChild(view, widthMeasureSpec - margins, heightMeasureSpec);

            node.setNoDirtyStyleWidth(view.getMeasuredWidth());
            node.setNoDirtyStyleHeight(view.getMeasuredHeight());
        }

        if (view instanceof LVViewGroup) {
            LVViewGroup viewGroup = (LVViewGroup) view;
            if (viewGroup.getCssNode().getChildCount() > 0) {
                viewGroup.measureChildNode(widthMeasureSpec, heightMeasureSpec);
            }
        }
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:24,代码来源:LVViewGroup.java

示例2: parseFlexNodeCSS

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
public static void parseFlexNodeCSS(CSSNode node, String cssString) {
    if (mCssString == cssString || mNode == node) {
        return;
    }

    mCssString = cssString;
    mNode = node;
    resetInlineMap();

    setPosition();
    setDirection();
    setAlignItems();
    setAlignSelf();
    setAlignContent();
    setJustfiyContent();
    setFlex();
    setFlexWrap();
    setSize();
    setMinSize();
    setMaxSize();
    setMargin();
    setPadding();
    setSizeToFit();
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:25,代码来源:FlexboxCSSParser.java

示例3: measure

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
@Override
public void measure(CSSNode node, float width, float height, MeasureOutput measureOutput) {
  // measure() should never be called before setThemedContext()
  EditText editText = Assertions.assertNotNull(mEditText);

  measureOutput.width = width;
  editText.setTextSize(
      TypedValue.COMPLEX_UNIT_PX,
      mFontSize == UNSET ?
          (int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP)) : mFontSize);
  mComputedPadding = spacingToFloatArray(getPadding());
  editText.setPadding(
      (int) Math.ceil(getPadding().get(Spacing.LEFT)),
      (int) Math.ceil(getPadding().get(Spacing.TOP)),
      (int) Math.ceil(getPadding().get(Spacing.RIGHT)),
      (int) Math.ceil(getPadding().get(Spacing.BOTTOM)));

  if (mNumberOfLines != UNSET) {
    editText.setLines(mNumberOfLines);
  }

  editText.measure(0 /* unspecified */, 0 /* unspecified */);
  measureOutput.height = editText.getMeasuredHeight();
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:25,代码来源:ReactTextInputShadowNode.java

示例4: measure

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
@Override
public void measure(CSSNode node, float width, float height, MeasureOutput measureOutput) {
  if (!mMeasured) {
    // Create a switch with the default config and measure it; since we don't (currently)
    // support setting custom switch text, this is fine, as all switches will measure the same
    // on a specific device/theme/locale combination.
    ReactSwitch reactSwitch = new ReactSwitch(getThemedContext());
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    reactSwitch.measure(spec, spec);
    mWidth = reactSwitch.getMeasuredWidth();
    mHeight = reactSwitch.getMeasuredHeight();
    mMeasured = true;
  }
  measureOutput.width = mWidth;
  measureOutput.height = mHeight;
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:19,代码来源:ReactSwitchManager.java

示例5: measure

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
@Override
public void measure(CSSNode node, float width, float height, MeasureOutput measureOutput) {
  final int style = ReactProgressBarViewManager.getStyleFromString(getStyle());
  if (!mMeasured.contains(style)) {
    ProgressBar progressBar = new ProgressBar(getThemedContext(), null, style);
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    progressBar.measure(spec, spec);
    mHeight.put(style, progressBar.getMeasuredHeight());
    mWidth.put(style, progressBar.getMeasuredWidth());
    mMeasured.add(style);
  }

  measureOutput.height = mHeight.get(style);
  measureOutput.width = mWidth.get(style);
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:18,代码来源:ProgressBarShadowNode.java

示例6: measure

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
@Override
public void measure(CSSNode node, float width, MeasureOutput measureOutput) {
    if (!mMeasured) {
        Spinner reactSwitch = new Spinner(getThemedContext());
        final int spec = View.MeasureSpec.makeMeasureSpec(
            ViewGroup.LayoutParams.WRAP_CONTENT,
            View.MeasureSpec.UNSPECIFIED
        );

        reactSwitch.measure(spec, spec);
        mWidth = reactSwitch.getMeasuredWidth();
        mHeight = reactSwitch.getMeasuredHeight();
        mMeasured = true;
    }

    measureOutput.width = mWidth;
    measureOutput.height = mHeight;
}
 
开发者ID:webschik,项目名称:react-native-spinner-android,代码行数:19,代码来源:SpinnerManager.java

示例7: measure

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
@Override
public void measure(CSSNode node, float width, float height, MeasureOutput measureOutput) {
  // measure() should never be called before setThemedContext()
  EditText editText = Assertions.assertNotNull(mEditText);

  measureOutput.width = width;
  editText.setTextSize(
      TypedValue.COMPLEX_UNIT_PX,
      mFontSize == UNSET ?
          (int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP)) : mFontSize);
  mComputedPadding = spacingToFloatArray(getPadding());
  editText.setPadding(
      (int) Math.ceil(getPadding().get(Spacing.LEFT)),
      (int) Math.ceil(getPadding().get(Spacing.TOP)),
      (int) Math.ceil(getPadding().get(Spacing.RIGHT)),
      (int) Math.ceil(getPadding().get(Spacing.BOTTOM)));

  if (mNumberOfLines != UNSET) {
    editText.setLines(mNumberOfLines);
  }

  editText.measure(MEASURE_SPEC, MEASURE_SPEC);
  measureOutput.height = editText.getMeasuredHeight();
}
 
开发者ID:bamlab,项目名称:react-native-text-input,代码行数:25,代码来源:ReactTextInputShadowNode.java

示例8: measure

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
@Override
public void measure(
    CSSNode node,
    float width,
    CSSMeasureMode widthMode,
    float height,
    CSSMeasureMode heightMode,
    MeasureOutput measureOutput) {
  if (!mMeasured) {
    // Create a switch with the default config and measure it; since we don't (currently)
    // support setting custom switch text, this is fine, as all switches will measure the same
    // on a specific device/theme/locale combination.
    ReactSwitch reactSwitch = new ReactSwitch(getThemedContext());
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    reactSwitch.measure(spec, spec);
    mWidth = reactSwitch.getMeasuredWidth();
    mHeight = reactSwitch.getMeasuredHeight();
    mMeasured = true;
  }
  measureOutput.width = mWidth;
  measureOutput.height = mHeight;
}
 
开发者ID:ManrajGrover,项目名称:react-native-box-loaders,代码行数:25,代码来源:ReactSwitchManager.java

示例9: measure

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
@Override
public void measure(
    CSSNode node,
    float width,
    CSSMeasureMode widthMode,
    float height,
    CSSMeasureMode heightMode,
    MeasureOutput measureOutput) {
  final int style = ReactProgressBarViewManager.getStyleFromString(getStyle());
  if (!mMeasured.contains(style)) {
    ProgressBar progressBar = ReactProgressBarViewManager.createProgressBar(getThemedContext(), style);
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    progressBar.measure(spec, spec);
    mHeight.put(style, progressBar.getMeasuredHeight());
    mWidth.put(style, progressBar.getMeasuredWidth());
    mMeasured.add(style);
  }

  measureOutput.height = mHeight.get(style);
  measureOutput.width = mWidth.get(style);
}
 
开发者ID:ManrajGrover,项目名称:react-native-box-loaders,代码行数:24,代码来源:ProgressBarShadowNode.java

示例10: measure

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
@Override
public void measure(
    CSSNode node,
    float width,
    CSSMeasureMode widthMode,
    float height,
    CSSMeasureMode heightMode,
    MeasureOutput measureOutput) {
  if (!mMeasured) {
    SeekBar reactSlider = new ReactSlider(getThemedContext(), null, STYLE);
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    reactSlider.measure(spec, spec);
    mWidth = reactSlider.getMeasuredWidth();
    mHeight = reactSlider.getMeasuredHeight();
    mMeasured = true;
  }
  measureOutput.width = mWidth;
  measureOutput.height = mHeight;
}
 
开发者ID:ManrajGrover,项目名称:react-native-box-loaders,代码行数:22,代码来源:ReactSliderManager.java

示例11: addChildAt

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
/**
 * We need to set the styleWidth and styleHeight of the one child (represented by the <View/>
 * within the <RCTModalHostView/> in Modal.js.  This needs to fill the entire window.
 */
@Override
@TargetApi(16)
public void addChildAt(CSSNode child, int i) {
  super.addChildAt(child, i);

  Context context = getThemedContext();
  WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
  Display display = wm.getDefaultDisplay();
  // getCurrentSizeRange will return the min and max width and height that the window can be
  display.getCurrentSizeRange(mMinPoint, mMaxPoint);

  int width, height;
  int rotation = display.getRotation();
  if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) {
    // If we are vertical the width value comes from min width and height comes from max height
    width = mMinPoint.x;
    height = mMaxPoint.y;
  } else {
    // If we are horizontal the width value comes from max width and height comes from min height
    width = mMaxPoint.x;
    height = mMinPoint.y;
  }
  child.setStyleWidth(width);
  child.setStyleHeight(height);
}
 
开发者ID:ManrajGrover,项目名称:react-native-box-loaders,代码行数:30,代码来源:ModalHostShadowNode.java

示例12: assignNodeLayoutParams

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
private void assignNodeLayoutParams() {
    int childNodeViewsCount = mChildNodeViews.size();
    for (int i = 0; i < childNodeViewsCount; i++) {
        UDView nodeView = mChildNodeViews.get(i);

        View view = nodeView.getView();
        CSSNode node = nodeView.getCssNode();

        if (view != null && node != null) {
            int x = (int) node.getLayoutX();
            int y = (int) node.getLayoutY();
            int width = (int) node.getLayoutWidth();
            int height = (int) node.getLayoutHeight();

            RelativeLayout.LayoutParams lParams = (LayoutParams) view.getLayoutParams();
            if (lParams == null) {
                lParams = new RelativeLayout.LayoutParams(width, height);
            } else {
                lParams.width = width;
                lParams.height = height;
            }

            lParams.setMargins(x, y, 0, 0);
            view.setLayoutParams(lParams);

            if (view instanceof LVViewGroup) {
                LVViewGroup viewGroup = (LVViewGroup) view;
                if (viewGroup.getCssNode().getChildCount() > 0) {
                    viewGroup.assignNodeLayoutParams();
                }
            }
        }
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:35,代码来源:LVViewGroup.java

示例13: setFlexCss

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
public UDView setFlexCss(String cssString) {
    if (mFlexCss == null || !mFlexCss.equals(cssString)) {
        CSSNode node = getCssNode();
        FlexboxCSSParser.parseFlexNodeCSS(node, cssString);
        mFlexCss = cssString;
    }

    return this;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:10,代码来源:UDView.java

示例14: addChildAt

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
@Override
public void addChildAt(CSSNode child, int i) {
  super.addChildAt(child, i);
  markUpdated();
  ReactShadowNode node = (ReactShadowNode) child;

  int increase = node.mIsLayoutOnly ? node.mTotalNativeChildren : 1;
  mTotalNativeChildren += increase;

  updateNativeChildrenCountInParent(increase);
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:12,代码来源:ReactShadowNode.java

示例15: measure

import com.facebook.csslayout.CSSNode; //导入依赖的package包/类
@Override
public void measure(
    CSSNode node,
    float width,
    CSSMeasureMode widthMode,
    float height,
    CSSMeasureMode heightMode,
    MeasureOutput measureOutput) {
  // measure() should never be called before setThemedContext()
  EditText editText = Assertions.assertNotNull(mEditText);

  measureOutput.width = widthMode == CSSMeasureMode.UNDEFINED ? CSSConstants.UNDEFINED : width;
  editText.setTextSize(
      TypedValue.COMPLEX_UNIT_PX,
      mFontSize == UNSET ?
          (int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP)) : mFontSize);
  mComputedPadding = spacingToFloatArray(getPadding());
  editText.setPadding(
      (int) Math.ceil(getPadding().get(Spacing.LEFT)),
      (int) Math.ceil(getPadding().get(Spacing.TOP)),
      (int) Math.ceil(getPadding().get(Spacing.RIGHT)),
      (int) Math.ceil(getPadding().get(Spacing.BOTTOM)));

  if (mNumberOfLines != UNSET) {
    editText.setLines(mNumberOfLines);
  }

  editText.measure(0 /* unspecified */, 0 /* unspecified */);
  measureOutput.height = editText.getMeasuredHeight();
}
 
开发者ID:ManrajGrover,项目名称:react-native-box-loaders,代码行数:31,代码来源:ReactTextInputShadowNode.java


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