本文整理汇总了Java中com.taobao.weex.ui.component.WXText类的典型用法代码示例。如果您正苦于以下问题:Java WXText类的具体用法?Java WXText怎么用?Java WXText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WXText类属于com.taobao.weex.ui.component包,在下文中一共展示了WXText类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSpanned
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
/**
* Update {@link #spanned} according to the give charSequence and styles
* @param text the give raw text.
* @return an Spanned contains text and spans
*/
private
@NonNull
Spanned createSpanned(String text) {
if (!TextUtils.isEmpty(text)) {
SpannableString spannable = new SpannableString(text);
List<SetSpanOperation> ops = createSetSpanOperation(spannable.length());
if (mFontSize == UNSET) {
ops.add(new SetSpanOperation(0, spannable.length(),
new AbsoluteSizeSpan(WXText.sDEFAULT_SIZE)));
}
Collections.reverse(ops);
for (SetSpanOperation op : ops) {
op.execute(spannable);
}
return spannable;
}
return new SpannableString("");
}
示例2: updateSpannableStringBuilder
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
/**
* Update {@link #spannableStringBuilder} according to the give charSequence and {@link #style}
* @param text the give raw text.
* @return an editable contains text and spans
*/
private Editable updateSpannableStringBuilder(String text) {
spannableStringBuilder.clear();
if (text != null) {
spannableStringBuilder.append(text);
}
List<SetSpanOperation> ops = createSetSpanOperation(spannableStringBuilder.length());
if (mFontSize == UNSET) {
spannableStringBuilder.setSpan(
new AbsoluteSizeSpan(WXText.sDEFAULT_SIZE), 0, spannableStringBuilder
.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
}
Collections.reverse(ops);
for (SetSpanOperation op : ops) {
op.execute(spannableStringBuilder);
}
return spannableStringBuilder;
}
示例3: getFontSize
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
public static int getFontSize(Map<String, Object> style) {
if (style == null) {
return (int) WXViewUtils.getRealPxByWidth(WXText.sDEFAULT_SIZE);
}
int fontSize = WXUtils.getInt(style.get(Constants.Name.FONT_SIZE));
if (fontSize <= 0) {
fontSize = WXText.sDEFAULT_SIZE;
}
return (int) WXViewUtils.getRealPxByWidth(fontSize);
}
示例4: getTimeFontSize
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
public int getTimeFontSize() {
int fontSize = WXUtils.getInt(get("timeFontSize"));
if (fontSize <= 0) {
fontSize = WXText.sDEFAULT_SIZE;
}
return fontSize;
}
示例5: BasicEditTextDomObject
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
public BasicEditTextDomObject() {
super();
mPaint.setTextSize(WXViewUtils.getRealPxByWidth(WXText.sDEFAULT_SIZE));
setMeasureFunction(new MeasureFunction() {
@Override
public void measure(CSSNode node, float width, MeasureOutput measureOutput) {
if (CSSConstants.isUndefined(width)) {
width = node.cssstyle.maxWidth;
}
measureOutput.height = getMeasureHeight();
measureOutput.width = width;
}
});
}
示例6: getFontSize
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
public static int getFontSize(Map<String, Object> style,int viewPortW) {
if (style == null) {
return (int) WXViewUtils.getRealPxByWidth(WXText.sDEFAULT_SIZE,viewPortW);
}
int fontSize = WXUtils.getInt(style.get(Constants.Name.FONT_SIZE));
if (fontSize <= 0) {
fontSize = WXText.sDEFAULT_SIZE;
}
return (int) WXViewUtils.getRealPxByWidth(fontSize,viewPortW);
}
示例7: BasicEditTextDomObject
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
public BasicEditTextDomObject() {
super();
mPaint.setTextSize(WXViewUtils.getRealPxByWidth(WXText.sDEFAULT_SIZE,getViewPortWidth()));
setMeasureFunction(new MeasureFunction() {
@Override
public void measure(CSSNode node, float width, MeasureOutput measureOutput) {
if (CSSConstants.isUndefined(width)) {
width = node.cssstyle.maxWidth;
}
measureOutput.height = getMeasureHeight();
measureOutput.width = width;
}
});
}
示例8: updateSpannable
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
protected void updateSpannable(Spannable spannable, int spanFlag) {
List<SetSpanOperation> ops = createSetSpanOperation(spannable.length(), spanFlag);
if (mFontSize == UNSET) {
ops.add(new SetSpanOperation(0, spannable.length(),
new AbsoluteSizeSpan(WXText.sDEFAULT_SIZE), spanFlag));
}
Collections.reverse(ops);
for (SetSpanOperation op : ops) {
op.execute(spannable);
}
}
示例9: setTextLayout
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
public void setTextLayout(Layout layout) {
this.textLayout = layout;
if(layout!=null && !mIsLabelSet){
setContentDescription(layout.getText());
}
if (mWeakReference != null) {
WXText wxText = mWeakReference.get();
if (wxText != null) {
wxText.readyToRender();
}
}
}
示例10: setTextLayout
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
public void setTextLayout(Layout layout) {
this.textLayout = layout;
if(layout!=null){
setContentDescription(layout.getText());
}
if (mWeakReference != null) {
WXText wxText = mWeakReference.get();
if (wxText != null) {
wxText.readyToRender();
}
}
}
示例11: getFontSize
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
public static int getFontSize(Map<String, Object> style) {
if (style == null) {
return (int) WXViewUtils.getRealPxByWidth(WXText.sDEFAULT_SIZE);
}
int fontSize = WXUtils.getInt(style.get(WXDomPropConstant.WX_FONTSIZE));
if (fontSize <= 0) {
fontSize = WXText.sDEFAULT_SIZE;
}
return (int) WXViewUtils.getRealPxByWidth(fontSize);
}
示例12: register
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
private static void register() {
try {
registerComponent(WXBasicComponentType.TEXT, WXText.class, false);
registerComponent(WXBasicComponentType.IMG, WXImage.class, false);
registerComponent(WXBasicComponentType.DIV, WXDiv.class, false);
registerComponent(WXBasicComponentType.IMAGE, WXImage.class, false);
registerComponent(WXBasicComponentType.CONTAINER, WXDiv.class, false);
registerComponent(WXBasicComponentType.SCROLLER, WXScroller.class, false);
registerComponent(WXBasicComponentType.SLIDER, WXSlider.class, true);
registerComponent(WXListComponent.class, false,WXBasicComponentType.LIST,WXBasicComponentType.VLIST);
registerComponent(HorizontalListComponent.class,false,WXBasicComponentType.HLIST);
registerComponent(WXBasicComponentType.CELL, WXCell.class, true);
registerComponent(WXBasicComponentType.INDICATOR, WXIndicator.class, true);
registerComponent(WXBasicComponentType.VIDEO, WXVideo.class, false);
registerComponent(WXBasicComponentType.INPUT, WXInput.class, false);
registerComponent(WXBasicComponentType.SWITCH, WXSwitch.class, false);
registerComponent(WXBasicComponentType.A, WXA.class, false);
registerComponent(WXBasicComponentType.EMBED, WXEmbed.class, true);
registerComponent(WXBasicComponentType.WEB, WXWeb.class);
registerComponent(WXBasicComponentType.REFRESH, WXRefresh.class);
registerComponent(WXBasicComponentType.LOADING, WXLoading.class);
registerComponent(WXBasicComponentType.LOADING_INDICATOR, WXLoadingIndicator.class);
registerModule("dom", WXDomModule.class, true);
registerModule("modal", WXModalUIModule.class, false);
registerModule("instanceWrap", WXInstanceWrap.class, true);
registerModule("animation", WXAnimationModule.class, true);
registerModule("webview", WXWebViewModule.class, true);
registerModule("navigator", WXNavigatorModule.class);
registerModule("stream", WXStreamModule.class);
registerDomObject(WXBasicComponentType.TEXT, WXTextDomObject.class);
registerDomObject(WXBasicComponentType.INPUT, WXTextDomObject.class);
registerDomObject(WXBasicComponentType.SWITCH, WXSwitchDomObject.class);
} catch (WXException e) {
WXLogUtils.e("[WXSDKEngine] register:" + WXLogUtils.getStackTrace(e));
}
}
示例13: holdComponent
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
@Override
public void holdComponent(WXText component) {
mWeakReference = new WeakReference<>(component);
}
示例14: getComponent
import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
@Nullable
@Override
public WXText getComponent() {
return null != mWeakReference ? mWeakReference.get() : null;
}