本文整理汇总了Java中android.text.TextUtils.TruncateAt方法的典型用法代码示例。如果您正苦于以下问题:Java TextUtils.TruncateAt方法的具体用法?Java TextUtils.TruncateAt怎么用?Java TextUtils.TruncateAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.TextUtils
的用法示例。
在下文中一共展示了TextUtils.TruncateAt方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEllipsizeType
import android.text.TextUtils; //导入方法依赖的package包/类
private TextUtils.TruncateAt getEllipsizeType() {
switch (mTextEllipsize) {
case TEXT_ELLIPSIZE_START:
return TextUtils.TruncateAt.START;
case TEXT_ELLIPSIZE_MIDDLE:
return TextUtils.TruncateAt.MIDDLE;
case TEXT_ELLIPSIZE_END:
return TextUtils.TruncateAt.END;
default:
throw new IllegalArgumentException("Illegal text ellipsize type.");
}
}
示例2: setEllipsize
import android.text.TextUtils; //导入方法依赖的package包/类
/**
* 设置超出部分的显示方式
*
* @param truncateAt
* @return
*/
public UDTextView setEllipsize(TextUtils.TruncateAt truncateAt) {
final T view = getView();
if (view != null) {
view.setEllipsize(truncateAt);
}
return this;
}
示例3: parse
import android.text.TextUtils; //导入方法依赖的package包/类
public static TextUtils.TruncateAt parse(String ellipsizeName, TextUtils.TruncateAt defaultValue) {
try {
return TextUtils.TruncateAt.valueOf(ellipsizeName);
} catch (Exception e) {
e.printStackTrace();
return defaultValue;
}
}
示例4: setEllipsize
import android.text.TextUtils; //导入方法依赖的package包/类
public void setEllipsize(TextUtils.TruncateAt where) {
if (mEllipsize != where) {
mEllipsize = where;
requestLayout();
invalidate();
}
}
示例5: getTruncateAt
import android.text.TextUtils; //导入方法依赖的package包/类
protected TextUtils.TruncateAt getTruncateAt() {
switch (mAttrsHelper.mEllipsize) {
// do not support marque
case 1:
return TextUtils.TruncateAt.START;
case 2:
return TextUtils.TruncateAt.MIDDLE;
case 3:
return TextUtils.TruncateAt.END;
default:
return null;
}
}
示例6: setEllipsize
import android.text.TextUtils; //导入方法依赖的package包/类
public LuaValue setEllipsize(U view, Varargs varargs) {
//TODO 这里需要统一
final String ellipsizeName = varargs.optjstring(2, TextUtils.TruncateAt.END.name());
final TextUtils.TruncateAt ellipsize = UDEllipsize.parse(ellipsizeName);
return view.setEllipsize(ellipsize);
}
示例7: init
import android.text.TextUtils; //导入方法依赖的package包/类
public static void init() {
if (initialized) {
return;
}
try {
final Class<?> textDirClass;
if (Build.VERSION.SDK_INT >= 18) {
textDirClass = TextDirectionHeuristic.class;
sTextDirection = TextDirectionHeuristics.FIRSTSTRONG_LTR;
} else {
ClassLoader loader = StaticLayoutEx.class.getClassLoader();
textDirClass = loader.loadClass(TEXT_DIR_CLASS);
Class<?> textDirsClass = loader.loadClass(TEXT_DIRS_CLASS);
sTextDirection = textDirsClass.getField(TEXT_DIR_FIRSTSTRONG_LTR).get(textDirsClass);
}
final Class<?>[] signature = new Class[]{
CharSequence.class,
int.class,
int.class,
TextPaint.class,
int.class,
Layout.Alignment.class,
textDirClass,
float.class,
float.class,
boolean.class,
TextUtils.TruncateAt.class,
int.class,
int.class
};
sConstructor = StaticLayout.class.getDeclaredConstructor(signature);
sConstructor.setAccessible(true);
sConstructorArgs = new Object[signature.length];
initialized = true;
} catch (Throwable e) {
FileLog.e("tmessages", e);
}
}
示例8: createStaticLayout
import android.text.TextUtils; //导入方法依赖的package包/类
public static StaticLayout createStaticLayout(CharSequence source, TextPaint paint, int width, Layout.Alignment align, float spacingmult, float spacingadd, boolean includepad, TextUtils.TruncateAt ellipsize, int ellipsisWidth, int maxLines) {
return createStaticLayout(source, 0, source.length(), paint, width, align, spacingmult, spacingadd, includepad, ellipsize, ellipsisWidth, maxLines);
}
示例9: createTextLayout
import android.text.TextUtils; //导入方法依赖的package包/类
private static Layout createTextLayout(
int width,
YogaMeasureMode widthMode,
TextUtils.TruncateAt ellipsize,
boolean shouldIncludeFontPadding,
int maxLines,
boolean isSingleLine,
CharSequence text,
int textSize,
float extraSpacing,
float spacingMultiplier,
int textStyle,
Layout.Alignment textAlignment) {
Layout newLayout;
final @TextLayoutBuilder.MeasureMode int textMeasureMode;
switch (widthMode) {
case UNDEFINED:
textMeasureMode = TextLayoutBuilder.MEASURE_MODE_UNSPECIFIED;
break;
case EXACTLY:
textMeasureMode = TextLayoutBuilder.MEASURE_MODE_EXACTLY;
break;
case AT_MOST:
textMeasureMode = TextLayoutBuilder.MEASURE_MODE_AT_MOST;
break;
default:
throw new IllegalStateException("Unexpected size mode: " + widthMode);
}
sTextLayoutBuilder
.setEllipsize(ellipsize)
.setMaxLines(maxLines)
.setSingleLine(isSingleLine)
.setText(text)
.setTextSize(textSize)
.setWidth(width, textMeasureMode);
sTextLayoutBuilder.setTextStyle(textStyle);
sTextLayoutBuilder.setTextDirection(TextDirectionHeuristicsCompat.FIRSTSTRONG_LTR);
sTextLayoutBuilder.setIncludeFontPadding(shouldIncludeFontPadding);
sTextLayoutBuilder.setTextSpacingExtra(extraSpacing);
sTextLayoutBuilder.setTextSpacingMultiplier(spacingMultiplier);
sTextLayoutBuilder.setAlignment(textAlignment);
newLayout = sTextLayoutBuilder.build();
sTextLayoutBuilder.setText(null);
return newLayout;
}
示例10: setEllipsize
import android.text.TextUtils; //导入方法依赖的package包/类
public void setEllipsize(TextUtils.TruncateAt truncateAt) {
if (this.mEllipsize != truncateAt) {
this.mEllipsize = truncateAt;
}
}
示例11: setEllipsize
import android.text.TextUtils; //导入方法依赖的package包/类
@Override
public void setEllipsize(TextUtils.TruncateAt where) {
super.setEllipsize(where);
requestLayout();
}
示例12: setEllipsize
import android.text.TextUtils; //导入方法依赖的package包/类
public void setEllipsize(TextUtils.TruncateAt ell) {
mText.setEllipsize(ell);
}
示例13: updateView
import android.text.TextUtils; //导入方法依赖的package包/类
public void updateView() {
@Nullable TextUtils.TruncateAt ellipsizeLocation = mNumberOfLines == ViewDefaults.NUMBER_OF_LINES ? null : mEllipsizeLocation;
setEllipsize(ellipsizeLocation);
}
示例14: setEllipsizeLocation
import android.text.TextUtils; //导入方法依赖的package包/类
public void setEllipsizeLocation(TextUtils.TruncateAt ellipsizeLocation) {
mEllipsizeLocation = ellipsizeLocation;
}