本文整理汇总了Java中com.facebook.csslayout.Spacing类的典型用法代码示例。如果您正苦于以下问题:Java Spacing类的具体用法?Java Spacing怎么用?Java Spacing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Spacing类属于com.facebook.csslayout包,在下文中一共展示了Spacing类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: measureChildNode
import com.facebook.csslayout.Spacing; //导入依赖的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: setThemedContext
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
@Override
public void setThemedContext(ThemedReactContext themedContext) {
super.setThemedContext(themedContext);
// TODO #7120264: cache this stuff better
mEditText = new EditText(getThemedContext());
// This is needed to fix an android bug since 4.4.3 which will throw an NPE in measure,
// setting the layoutParams fixes it: https://code.google.com/p/android/issues/detail?id=75877
mEditText.setLayoutParams(
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
setDefaultPadding(Spacing.LEFT, mEditText.getPaddingLeft());
setDefaultPadding(Spacing.TOP, mEditText.getPaddingTop());
setDefaultPadding(Spacing.RIGHT, mEditText.getPaddingRight());
setDefaultPadding(Spacing.BOTTOM, mEditText.getPaddingBottom());
mComputedPadding = spacingToFloatArray(getPadding());
}
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:20,代码来源:ReactTextInputShadowNode.java
示例3: measure
import com.facebook.csslayout.Spacing; //导入依赖的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.Spacing; //导入依赖的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
示例5: setThemedContext
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
@Override
public void setThemedContext(ThemedReactContext themedContext) {
super.setThemedContext(themedContext);
// TODO #7120264: cache this stuff better
mEditText = new EditText(getThemedContext());
// This is needed to fix an android bug since 4.4.3 which will throw an NPE in measure,
// setting the layoutParams fixes it: https://code.google.com/p/android/issues/detail?id=75877
mEditText.setLayoutParams(
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
setDefaultPadding(Spacing.START, mEditText.getPaddingStart());
setDefaultPadding(Spacing.TOP, mEditText.getPaddingTop());
setDefaultPadding(Spacing.END, mEditText.getPaddingEnd());
setDefaultPadding(Spacing.BOTTOM, mEditText.getPaddingBottom());
mComputedPadding = new float[] {
getPadding(Spacing.START),
getPadding(Spacing.TOP),
getPadding(Spacing.END),
getPadding(Spacing.BOTTOM),
};
}
开发者ID:Right-Men,项目名称:Ironman,代码行数:25,代码来源:ReactTextInputShadowNode.java
示例6: onCollectExtraUpdates
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
@Override
public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) {
if (mIsVirtual) {
return;
}
super.onCollectExtraUpdates(uiViewOperationQueue);
if (mPreparedSpannableText != null) {
ReactTextUpdate reactTextUpdate =
new ReactTextUpdate(
mPreparedSpannableText,
UNSET,
mContainsImages,
getPadding(Spacing.START),
getPadding(Spacing.TOP),
getPadding(Spacing.END),
getPadding(Spacing.BOTTOM),
getTextAlign()
);
uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate);
}
}
开发者ID:Right-Men,项目名称:Ironman,代码行数:22,代码来源:ReactTextShadowNode.java
示例7: setMargin
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
private static void setMargin() {
String margin = mInlineMap.get(MARGIN);
if (margin != null) {
Float fMargin = pixelFloat(margin);
mNode.setMargin(Spacing.LEFT, fMargin);
mNode.setMargin(Spacing.TOP, fMargin);
mNode.setMargin(Spacing.BOTTOM, fMargin);
mNode.setMargin(Spacing.RIGHT, fMargin);
}
String marginLeft = mInlineMap.get(MARGINLEFT);
if (marginLeft != null) {
mNode.setMargin(Spacing.LEFT, pixelFloat(marginLeft));
}
String marginTop = mInlineMap.get(MARGINTOP);
if (marginTop != null) {
mNode.setMargin(Spacing.TOP, pixelFloat(marginTop));
}
String marginBottom = mInlineMap.get(MARGINBOTTOM);
if (marginBottom != null) {
mNode.setMargin(Spacing.BOTTOM, pixelFloat(marginBottom));
}
String marginRight = mInlineMap.get(MARGINRIGHT);
if (marginRight != null) {
mNode.setMargin(Spacing.RIGHT, pixelFloat(marginRight));
}
}
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:31,代码来源:FlexboxCSSParser.java
示例8: setPadding
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
private static void setPadding() {
String padding = mInlineMap.get(PADDING);
if (padding != null) {
Float mPadding = pixelFloat(padding);
mNode.setPadding(Spacing.LEFT, mPadding);
mNode.setPadding(Spacing.TOP, mPadding);
mNode.setPadding(Spacing.BOTTOM, mPadding);
mNode.setPadding(Spacing.RIGHT, mPadding);
}
String paddingLeft = mInlineMap.get(PADDINGLEFT);
if (paddingLeft != null) {
mNode.setPadding(Spacing.LEFT, pixelFloat(paddingLeft));
}
String paddingTop = mInlineMap.get(PADDINGTOP);
if (paddingTop != null) {
mNode.setPadding(Spacing.TOP, pixelFloat(paddingTop));
}
String paddingBottom = mInlineMap.get(PADDINGBOTTOM);
if (paddingBottom != null) {
mNode.setPadding(Spacing.BOTTOM, pixelFloat(paddingBottom));
}
String paddingRight = mInlineMap.get(PADDINGRIGHT);
if (paddingRight != null) {
mNode.setPadding(Spacing.RIGHT, pixelFloat(paddingRight));
}
}
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:31,代码来源:FlexboxCSSParser.java
示例9: spacingToFloatArray
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
private static float[] spacingToFloatArray(Spacing spacing) {
return new float[] {
spacing.get(Spacing.LEFT),
spacing.get(Spacing.TOP),
spacing.get(Spacing.RIGHT),
spacing.get(Spacing.BOTTOM),
};
}
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:9,代码来源:ReactTextInputShadowNode.java
示例10: measure
import com.facebook.csslayout.Spacing; //导入依赖的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
示例11: measure
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
@Override
public void measure(
CSSNodeAPI node,
float width,
CSSMeasureMode widthMode,
float height,
CSSMeasureMode heightMode,
MeasureOutput measureOutput) {
// measure() should never be called before setThemedContext()
EditText editText = Assertions.assertNotNull(mEditText);
editText.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
mFontSize == UNSET ?
(int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP)) : mFontSize);
mComputedPadding = new float[] {
getPadding(Spacing.START),
getPadding(Spacing.TOP),
getPadding(Spacing.END),
getPadding(Spacing.BOTTOM),
};
editText.setPadding(
(int) Math.floor(getPadding(Spacing.START)),
(int) Math.floor(getPadding(Spacing.TOP)),
(int) Math.floor(getPadding(Spacing.END)),
(int) Math.floor(getPadding(Spacing.BOTTOM)));
if (mNumberOfLines != UNSET) {
editText.setLines(mNumberOfLines);
}
editText.measure(
MeasureUtil.getMeasureSpec(width, widthMode),
MeasureUtil.getMeasureSpec(height, heightMode));
measureOutput.width = editText.getMeasuredWidth();
measureOutput.height = editText.getMeasuredHeight();
}
开发者ID:Right-Men,项目名称:Ironman,代码行数:38,代码来源:ReactTextInputShadowNode.java
示例12: onCollectExtraUpdates
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
@Override
public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) {
super.onCollectExtraUpdates(uiViewOperationQueue);
if (mComputedPadding != null) {
float[] updatedPadding = mComputedPadding;
if (getLayoutDirection() == CSSDirection.RTL) {
updatedPadding = new float[] {
getPadding(Spacing.END),
getPadding(Spacing.TOP),
getPadding(Spacing.START),
getPadding(Spacing.BOTTOM),
};
}
uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), updatedPadding);
mComputedPadding = null;
}
if (mJsEventCount != UNSET) {
Spannable preparedSpannableText = fromTextCSSNode(this);
ReactTextUpdate reactTextUpdate =
new ReactTextUpdate(
preparedSpannableText,
mJsEventCount,
mContainsImages,
getPadding(Spacing.START),
getPadding(Spacing.TOP),
getPadding(Spacing.END),
getPadding(Spacing.BOTTOM),
mTextAlign
);
uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate);
}
}
开发者ID:Right-Men,项目名称:Ironman,代码行数:34,代码来源:ReactTextInputShadowNode.java
示例13: setPadding
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
@Override
public void setPadding(int spacingType, float padding) {
super.setPadding(spacingType, padding);
mComputedPadding = new float[] {
getPadding(Spacing.START),
getPadding(Spacing.TOP),
getPadding(Spacing.END),
getPadding(Spacing.BOTTOM),
};
markUpdated();
}
开发者ID:Right-Men,项目名称:Ironman,代码行数:12,代码来源:ReactTextInputShadowNode.java
示例14: getFullBorderColor
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
/**
* We use this method for getting color for rounded borders only similarly as for
* {@link #getFullBorderWidth}.
*/
private int getFullBorderColor() {
float rgb = (mBorderRGB != null && !CSSConstants.isUndefined(mBorderRGB.getRaw(Spacing.ALL))) ?
mBorderRGB.getRaw(Spacing.ALL) : DEFAULT_BORDER_RGB;
float alpha = (mBorderAlpha != null && !CSSConstants.isUndefined(mBorderAlpha.getRaw(Spacing.ALL))) ?
mBorderAlpha.getRaw(Spacing.ALL) : DEFAULT_BORDER_ALPHA;
return ReactViewBackgroundDrawable.colorFromAlphaAndRGBComponents(alpha, rgb);
}
开发者ID:Right-Men,项目名称:Ironman,代码行数:12,代码来源:ReactViewBackgroundDrawable.java
示例15: updatePadding
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
private void updatePadding() {
for (int spacingType = Spacing.LEFT; spacingType <= Spacing.ALL; spacingType++) {
if (spacingType == Spacing.LEFT ||
spacingType == Spacing.RIGHT ||
spacingType == Spacing.START ||
spacingType == Spacing.END) {
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType)) &&
CSSConstants.isUndefined(mPadding.getRaw(Spacing.HORIZONTAL)) &&
CSSConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
super.setPadding(spacingType, mDefaultPadding.getRaw(spacingType));
} else {
super.setPadding(spacingType, mPadding.getRaw(spacingType));
}
} else if (spacingType == Spacing.TOP || spacingType == Spacing.BOTTOM) {
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType)) &&
CSSConstants.isUndefined(mPadding.getRaw(Spacing.VERTICAL)) &&
CSSConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
super.setPadding(spacingType, mDefaultPadding.getRaw(spacingType));
} else {
super.setPadding(spacingType, mPadding.getRaw(spacingType));
}
} else {
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType))) {
super.setPadding(spacingType, mDefaultPadding.getRaw(spacingType));
} else {
super.setPadding(spacingType, mPadding.getRaw(spacingType));
}
}
}
}
开发者ID:Right-Men,项目名称:Ironman,代码行数:31,代码来源:ReactShadowNode.java
示例16: testDimensions
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
@Test
public void testDimensions() {
LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
ReactStylesDiffMap map = spy(
buildStyles(
"width",
10.0,
"height",
10.0,
"left",
10.0,
"top",
10.0));
reactShadowNode.updateProperties(map);
verify(reactShadowNode).setStyleWidth(anyFloat());
verify(map).getFloat(eq("width"), anyFloat());
verify(reactShadowNode).setStyleHeight(anyFloat());
verify(map).getFloat(eq("height"), anyFloat());
verify(reactShadowNode).setPosition(eq(Spacing.START), anyFloat());
verify(map).getFloat(eq("left"), anyFloat());
verify(reactShadowNode).setPosition(eq(Spacing.TOP), anyFloat());
verify(map).getFloat(eq("top"), anyFloat());
reactShadowNode = spy(new LayoutShadowNode());
map = spy(buildStyles());
reactShadowNode.updateProperties(map);
verify(reactShadowNode, never()).setStyleWidth(anyFloat());
verify(map, never()).getFloat(eq("width"), anyFloat());
verify(reactShadowNode, never()).setStyleHeight(anyFloat());
verify(map, never()).getFloat(eq("height"), anyFloat());
verify(reactShadowNode, never()).setPosition(eq(Spacing.START), anyFloat());
verify(map, never()).getFloat(eq("left"), anyFloat());
verify(reactShadowNode, never()).setPosition(eq(Spacing.TOP), anyFloat());
verify(map, never()).getFloat(eq("top"), anyFloat());
}
开发者ID:Right-Men,项目名称:Ironman,代码行数:38,代码来源:LayoutPropertyApplicatorTest.java
示例17: testPosition
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
@Test
public void testPosition() {
LayoutShadowNode reactShadowNode = spy(new LayoutShadowNode());
ReactStylesDiffMap map = spy(buildStyles(
"position",
"absolute",
"bottom",
10.0,
"right",
5.0));
reactShadowNode.updateProperties(map);
verify(reactShadowNode).setPosition(eq(Spacing.BOTTOM), anyFloat());
verify(reactShadowNode).setPosition(eq(Spacing.END), anyFloat());
verify(reactShadowNode).setPositionType(any(CSSPositionType.class));
verify(map).getFloat("bottom", Float.NaN);
verify(map).getFloat("right", Float.NaN);
reactShadowNode = spy(new LayoutShadowNode());
map = spy(buildStyles());
reactShadowNode.updateProperties(map);
verify(reactShadowNode, never()).setPosition(eq(Spacing.BOTTOM), anyFloat());
verify(reactShadowNode, never()).setPosition(eq(Spacing.END), anyFloat());
verify(reactShadowNode, never()).setPositionType(any(CSSPositionType.class));
verify(map, never()).getFloat("bottom", Float.NaN);
verify(map, never()).getFloat("right", Float.NaN);
}
开发者ID:Right-Men,项目名称:Ironman,代码行数:29,代码来源:LayoutPropertyApplicatorTest.java
示例18: clear
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
public void clear() {
style.direction = CSSDirection.INHERIT;
style.flexDirection = CSSFlexDirection.COLUMN;
style.justifyContent = CSSJustify.FLEX_START;
style.alignContent = CSSAlign.FLEX_START;
style.alignItems = CSSAlign.STRETCH;
style.alignSelf = CSSAlign.AUTO;
style.positionType = CSSPositionType.RELATIVE;
style.flexWrap = CSSWrap.NOWRAP;
style.flex = 0;
style.margin = new Spacing();
style.padding = new Spacing();
style.border = new Spacing();
style.positionTop = CSSConstants.UNDEFINED;
style.positionBottom = CSSConstants.UNDEFINED;
style.positionLeft = CSSConstants.UNDEFINED;
style.positionRight = CSSConstants.UNDEFINED;
style.width = CSSConstants.UNDEFINED;
style.height = CSSConstants.UNDEFINED;
style.minWidth = CSSConstants.UNDEFINED;
style.minHeight = CSSConstants.UNDEFINED;
style.maxWidth = CSSConstants.UNDEFINED;
style.maxHeight = CSSConstants.UNDEFINED;
}
开发者ID:zhangyuanwei,项目名称:CSSLayout,代码行数:30,代码来源:CSSLayout.java
示例19: fillCSSNode
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
void fillCSSNode(CSSNode node) {
if (width != WRAP_CONTENT && width != MATCH_PARENT) {
node.setStyleWidth(width);
} else {
node.setStyleWidth(CSSConstants.UNDEFINED);
}
if (height != WRAP_CONTENT && height != MATCH_PARENT) {
node.setStyleHeight(height);
} else {
node.setStyleHeight(CSSConstants.UNDEFINED);
}
node.setMinWidth(minWidth);
node.setMinHeight(minHeight);
node.setMaxWidth(maxWidth);
node.setMaxHeight(maxHeight);
node.setPositionLeft(left);
node.setPositionRight(right);
node.setPositionTop(top);
node.setPositionBottom(bottom);
node.setMargin(Spacing.ALL, margin);
node.setMargin(Spacing.LEFT, marginLeft);
node.setMargin(Spacing.RIGHT, marginRight);
node.setMargin(Spacing.TOP, marginTop);
node.setMargin(Spacing.BOTTOM, marginBottom);
node.setAlignSelf(alignSelf);
node.setFlex(flex);
node.setPositionType(position);
}
开发者ID:zhangyuanwei,项目名称:CSSLayout,代码行数:34,代码来源:CSSLayout.java
示例20: updatePath
import com.facebook.csslayout.Spacing; //导入依赖的package包/类
private void updatePath() {
if (!mNeedUpdatePathForBorderRadius) {
return;
}
mNeedUpdatePathForBorderRadius = false;
if (mPathForBorderRadius == null) {
mPathForBorderRadius = new Path();
mTempRectForBorderRadius = new RectF();
mPathForBorderRadiusOutline = new Path();
mTempRectForBorderRadiusOutline = new RectF();
}
mPathForBorderRadius.reset();
mPathForBorderRadiusOutline.reset();
mTempRectForBorderRadius.set(getBounds());
mTempRectForBorderRadiusOutline.set(getBounds());
float fullBorderWidth = getFullBorderWidth();
if (fullBorderWidth > 0) {
mTempRectForBorderRadius.inset(fullBorderWidth * 0.5f, fullBorderWidth * 0.5f);
}
float defaultBorderRadius = !CSSConstants.isUndefined(mBorderRadius) ? mBorderRadius : 0;
float topLeftRadius = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[0]) ? mBorderCornerRadii[0] : defaultBorderRadius;
float topRightRadius = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[1]) ? mBorderCornerRadii[1] : defaultBorderRadius;
float bottomRightRadius = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[2]) ? mBorderCornerRadii[2] : defaultBorderRadius;
float bottomLeftRadius = mBorderCornerRadii != null && !CSSConstants.isUndefined(mBorderCornerRadii[3]) ? mBorderCornerRadii[3] : defaultBorderRadius;
mPathForBorderRadius.addRoundRect(
mTempRectForBorderRadius,
new float[] {
topLeftRadius,
topLeftRadius,
topRightRadius,
topRightRadius,
bottomRightRadius,
bottomRightRadius,
bottomLeftRadius,
bottomLeftRadius
},
Path.Direction.CW);
float extraRadiusForOutline = 0;
if (mBorderWidth != null) {
extraRadiusForOutline = mBorderWidth.get(Spacing.ALL) / 2f;
}
mPathForBorderRadiusOutline.addRoundRect(
mTempRectForBorderRadiusOutline,
new float[] {
topLeftRadius + extraRadiusForOutline,
topLeftRadius + extraRadiusForOutline,
topRightRadius + extraRadiusForOutline,
topRightRadius + extraRadiusForOutline,
bottomRightRadius + extraRadiusForOutline,
bottomRightRadius + extraRadiusForOutline,
bottomLeftRadius + extraRadiusForOutline,
bottomLeftRadius + extraRadiusForOutline
},
Path.Direction.CW);
mPathEffectForBorderStyle = mBorderStyle != null
? mBorderStyle.getPathEffect(getFullBorderWidth())
: null;
}
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:68,代码来源:ReactViewBackgroundDrawable.java
注:本文中的com.facebook.csslayout.Spacing类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论