gpt4 book ai didi

com.facebook.yoga.YogaNode类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 06:49:31 27 4
gpt4 key购买 nike

本文整理了Java中com.facebook.yoga.YogaNode类的一些代码示例,展示了YogaNode类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YogaNode类的具体详情如下:
包路径:com.facebook.yoga.YogaNode
类名称:YogaNode

YogaNode介绍

暂无

代码示例

代码示例来源:origin: facebook/litho

void addChildAt(InternalNode child, int index) {
 mYogaNode.addChildAt(child.mYogaNode, index);
}

代码示例来源:origin: facebook/litho

void calculateLayout(float width, float height) {
 applyOverridesRecursive(this);
 mYogaNode.calculateLayout(width, height);
}

代码示例来源:origin: facebook/litho

InternalNode alignItems(YogaAlign alignItems) {
 mYogaNode.setAlignItems(alignItems);
 return this;
}

代码示例来源:origin: facebook/litho

void setStyleHeightFromSpec(int heightSpec) {
 switch (SizeSpec.getMode(heightSpec)) {
  case SizeSpec.UNSPECIFIED:
   mYogaNode.setHeight(YogaConstants.UNDEFINED);
   break;
  case SizeSpec.AT_MOST:
   mYogaNode.setMaxHeight(SizeSpec.getSize(heightSpec));
   break;
  case SizeSpec.EXACTLY:
   mYogaNode.setHeight(SizeSpec.getSize(heightSpec));
   break;
 }
}

代码示例来源:origin: koudle/AndYogaSample

YogaNode root = new YogaNode();
root.setWidth(500);
root.setHeight(300);
root.setAlignItems(YogaAlign.CENTER);
root.setJustifyContent(YogaJustify.CENTER);
root.setPadding(YogaEdge.ALL, 20);
YogaNode text = new YogaNode();
text.setWidth(200);
text.setHeight(25);
YogaNode image = new YogaNode();
image.setWidth(50);
image.setHeight(50);
image.setPositionType(YogaPositionType.ABSOLUTE);
image.setPosition(YogaEdge.END, 20);
image.setPosition(YogaEdge.TOP, 20);
root.addChildAt(text, 0);
root.addChildAt(image, 1);
root.calculateLayout();
buffer.append("text,layout X:").append(text.getLayoutX())
    .append(" layout Y:").append(text.getLayoutY()).append("\n")
    .append("image,layout X:").append(image.getLayoutX())
    .append(" layout Y:").append(image.getLayoutY());

代码示例来源:origin: facebook/litho

@Before
public void setUp() {
 mDiffNode = mock(DiffNode.class);
 mNode = mock(InternalNode.class);
 final YogaNode cssNode = new YogaNode();
 cssNode.setData(mNode);
 mNode.mYogaNode = cssNode;
 mockStatic(ComponentsPools.class);
 when(mNode.getLastWidthSpec()).thenReturn(-1);
 when(mNode.getDiffNode()).thenReturn(mDiffNode);
 when(mDiffNode.getLastMeasuredWidth()).thenReturn(-1f);
 when(mDiffNode.getLastMeasuredHeight()).thenReturn(-1f);
 when(ComponentsPools.acquireInternalNode(any(ComponentContext.class))).thenReturn(mNode);
 when(ComponentsPools.acquireComponentTreeBuilder(
     any(ComponentContext.class), any(Component.class)))
   .thenCallRealMethod();
 mockStatic(LayoutState.class);
 StateHandler stateHandler = mock(StateHandler.class);
 mContext = spy(new ComponentContext(RuntimeEnvironment.application, stateHandler));
 mNestedTreeWidthSpec = SizeSpec.makeSizeSpec(400, SizeSpec.EXACTLY);
 mNestedTreeHeightSpec = SizeSpec.makeSizeSpec(200, SizeSpec.EXACTLY);
}

代码示例来源:origin: facebook/litho

yogaNode.setPaddingPercent(LEFT, mNestedTreePadding.getRaw(YogaEdge.LEFT));
} else {
 yogaNode.setPadding(LEFT, mNestedTreePadding.getRaw(YogaEdge.LEFT));
 yogaNode.setPaddingPercent(TOP, mNestedTreePadding.getRaw(YogaEdge.TOP));
} else {
 yogaNode.setPadding(TOP, mNestedTreePadding.getRaw(YogaEdge.TOP));
 yogaNode.setPaddingPercent(RIGHT, mNestedTreePadding.getRaw(YogaEdge.RIGHT));
} else {
 yogaNode.setPadding(RIGHT, mNestedTreePadding.getRaw(YogaEdge.RIGHT));
 yogaNode.setPaddingPercent(BOTTOM, mNestedTreePadding.getRaw(YogaEdge.BOTTOM));
} else {
 yogaNode.setPadding(BOTTOM, mNestedTreePadding.getRaw(YogaEdge.BOTTOM));
 yogaNode.setPaddingPercent(VERTICAL, mNestedTreePadding.getRaw(YogaEdge.VERTICAL));
} else {
 yogaNode.setPadding(VERTICAL, mNestedTreePadding.getRaw(YogaEdge.VERTICAL));
 yogaNode.setPaddingPercent(HORIZONTAL, mNestedTreePadding.getRaw(YogaEdge.HORIZONTAL));
} else {
 yogaNode.setPadding(HORIZONTAL, mNestedTreePadding.getRaw(YogaEdge.HORIZONTAL));
 yogaNode.setPaddingPercent(START, mNestedTreePadding.getRaw(YogaEdge.START));
} else {
 yogaNode.setPadding(START, mNestedTreePadding.getRaw(YogaEdge.START));
 yogaNode.setPaddingPercent(END, mNestedTreePadding.getRaw(YogaEdge.END));

代码示例来源:origin: facebook/litho

static YogaNode acquireYogaNode() {
 initYogaConfigIfNecessary();
 YogaNode node = ComponentsConfiguration.disablePools ? null : sYogaNodePool.acquire();
 if (node == null) {
  node =
    PoolsConfig.sYogaNodeFactory != null
      ? PoolsConfig.sYogaNodeFactory.create(sYogaConfig)
      : new YogaNode(sYogaConfig);
 }
 return node;
}

代码示例来源:origin: facebook/litho

InternalNode justifyContent(YogaJustify justifyContent) {
 mYogaNode.setJustifyContent(justifyContent);
 return this;
}

代码示例来源:origin: facebook/litho

InternalNode heightPx(@Px int height) {
 mPrivateFlags |= PFLAG_HEIGHT_IS_SET;
 mYogaNode.setHeight(height);
 return this;
}

代码示例来源:origin: facebook/litho

void init(YogaNode yogaNode, ComponentContext componentContext) {
 if (yogaNode != null) {
  yogaNode.setData(this);
 }
 mYogaNode = yogaNode;
 mComponentContext = componentContext;
 if (mComponentContext.getExtraMemorySize() > 0) {
  mExtraMemory = new int[mComponentContext.getExtraMemorySize()];
 }
}

代码示例来源:origin: facebook/litho

@Px
@Override
public int getX() {
 if (YogaConstants.isUndefined(mResolvedX)) {
  mResolvedX = mYogaNode.getLayoutX();
 }
 return (int) mResolvedX;
}

代码示例来源:origin: facebook/litho

@Px
@Override
public int getY() {
 if (YogaConstants.isUndefined(mResolvedY)) {
  mResolvedY = mYogaNode.getLayoutY();
 }
 return (int) mResolvedY;
}

代码示例来源:origin: facebook/litho

InternalNode paddingPx(YogaEdge edge, @Px int padding) {
 mPrivateFlags |= PFLAG_PADDING_IS_SET;
 if (mIsNestedTreeHolder) {
  getNestedTreePadding().set(edge, padding);
  setIsPaddingPercent(edge, false);
 } else {
  mYogaNode.setPadding(edge, padding);
 }
 return this;
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com