本文整理汇总了Java中com.facebook.csslayout.MeasureOutput类的典型用法代码示例。如果您正苦于以下问题:Java MeasureOutput类的具体用法?Java MeasureOutput怎么用?Java MeasureOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MeasureOutput类属于com.facebook.csslayout包,在下文中一共展示了MeasureOutput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的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();
}
示例2: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的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;
}
示例3: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的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);
}
示例4: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的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;
}
示例5: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的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();
}
示例6: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的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;
}
示例7: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的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);
}
示例8: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的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;
}
示例9: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的package包/类
@Override
public void measure(
CSSNodeAPI 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;
}
示例10: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的package包/类
@Override
public void measure(
CSSNodeAPI 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);
}
示例11: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的package包/类
@Override
public void measure(
CSSNodeAPI 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;
}
示例12: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的package包/类
@Override
public void measure(com.facebook.csslayout.CSSNode node, float width, boolean isExactly, MeasureOutput measureOutput) {
CSSNode cssNode = ((CSSNode) node);
View bindingView = cssNode.bindingView;
int w, h;
if (CSSConstants.isUndefined(width)) {
w = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
} else {
w = MeasureSpec.makeMeasureSpec((int) width, isExactly ? MeasureSpec.EXACTLY : MeasureSpec.AT_MOST);
}
h = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
bindingView.measure(w, h);
measureOutput.width = bindingView.getMeasuredWidth();
measureOutput.height = bindingView.getMeasuredHeight();
cssNode.isMeasured = true;
}
示例13: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的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();
}
示例14: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的package包/类
@Override
public void measure(
CSSNode node,
float width,
CSSMeasureMode widthMode,
float height,
CSSMeasureMode heightMode,
MeasureOutput measureOutput) {
throw new IllegalStateException("SurfaceView should have explicit width and height set");
}
示例15: measure
import com.facebook.csslayout.MeasureOutput; //导入依赖的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();
}