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


Java WXText类代码示例

本文整理汇总了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("");
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:24,代码来源:WXTextDomObject.java

示例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;
}
 
开发者ID:Laisly,项目名称:weex,代码行数:23,代码来源:WXTextDomObject.java

示例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);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:11,代码来源:WXStyle.java

示例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;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:8,代码来源:WXStyle.java

示例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;
    }
  });
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:15,代码来源:BasicEditTextDomObject.java

示例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);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:11,代码来源:WXStyle.java

示例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;
    }
  });
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:15,代码来源:BasicEditTextDomObject.java

示例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);
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:12,代码来源:WXTextDomObject.java

示例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();
    }
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:13,代码来源:WXTextView.java

示例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();
    }
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:13,代码来源:WXTextView.java

示例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);
}
 
开发者ID:Laisly,项目名称:weex,代码行数:11,代码来源:WXStyle.java

示例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));
  }
}
 
开发者ID:Laisly,项目名称:weex,代码行数:40,代码来源:WXSDKEngine.java

示例13: holdComponent

import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
@Override
public void holdComponent(WXText component) {
  mWeakReference = new WeakReference<>(component);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:5,代码来源:WXTextView.java

示例14: getComponent

import com.taobao.weex.ui.component.WXText; //导入依赖的package包/类
@Nullable
@Override
public WXText getComponent() {
   return null != mWeakReference ? mWeakReference.get() : null;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:6,代码来源:WXTextView.java


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