本文整理汇总了Java中android.text.TextPaint.setFlags方法的典型用法代码示例。如果您正苦于以下问题:Java TextPaint.setFlags方法的具体用法?Java TextPaint.setFlags怎么用?Java TextPaint.setFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.TextPaint
的用法示例。
在下文中一共展示了TextPaint.setFlags方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import android.text.TextPaint; //导入方法依赖的package包/类
private void init(AttributeSet attrs, int defStyle) {
setWillNotDraw(false);
// Load attributes
final TypedArray a = getContext().obtainStyledAttributes(
attrs, R.styleable.FadingEdgeView, defStyle, 0);
a.recycle();
// Set up a default TextPaint object
mTextPaint = new TextPaint();
mTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
mTextPaint.setTextAlign(Paint.Align.LEFT);
// Update TextPaint and text measurements from attributes
invalidateTextPaintAndMeasurements();
}
示例2: updateMeasureState
import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public void updateMeasureState(TextPaint p) {
p.setTypeface(mTypeface);
// Note: This flag is required for proper typeface rendering
p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
示例3: updateDrawState
import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public void updateDrawState(TextPaint tp) {
tp.setTypeface(mTypeface);
// Note: This flag is required for proper typeface rendering
tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
示例4: updateMeasureState
import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public void updateMeasureState(TextPaint p) {
if (mTypeface != null) {
p.setTypeface(mTypeface);
}
if (textSize != 0) {
p.setTextSize(textSize);
}
p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
示例5: updateDrawState
import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public void updateDrawState(TextPaint tp) {
if (mTypeface != null) {
tp.setTypeface(mTypeface);
}
if (textSize != 0) {
tp.setTextSize(textSize);
}
if (color != 0) {
tp.setColor(color);
}
tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
示例6: init
import android.text.TextPaint; //导入方法依赖的package包/类
private void init(AttributeSet attrs, int defStyle) {
final TypedArray a = getContext().obtainStyledAttributes(
attrs, R.styleable.RoundedLetterView, defStyle, 0);
if(a.hasValue(R.styleable.RoundedLetterView_rlv_titleText)){
mTitleText = a.getString(R.styleable.RoundedLetterView_rlv_titleText);
}
mTitleColor = a.getColor(R.styleable.RoundedLetterView_rlv_titleColor,DEFAULT_TITLE_COLOR);
mBackgroundColor = a.getColor(R.styleable.RoundedLetterView_rlv_backgroundColorValue,DEFAULT_BACKGROUND_COLOR);
mTitleSize = a.getDimension(R.styleable.RoundedLetterView_rlv_titleSize,DEFAULT_TITLE_SIZE);
a.recycle();
//Title TextPaint
mTitleTextPaint = new TextPaint();
mTitleTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
mTitleTextPaint.setTypeface(mFont);
mTitleTextPaint.setTextAlign(Paint.Align.CENTER);
mTitleTextPaint.setLinearText(true);
mTitleTextPaint.setColor(mTitleColor);
mTitleTextPaint.setTextSize(mTitleSize);
//Background Paint
mBackgroundPaint = new Paint();
mBackgroundPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
mBackgroundPaint.setStyle(Paint.Style.FILL);
mBackgroundPaint.setColor(mBackgroundColor);
mInnerRectF = new RectF();
}
示例7: updateMeasureState
import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public void updateMeasureState(TextPaint p) {
p.setTypeface(mTypeface);
// Note: This flag is required for proper typeface rendering
p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
示例8: updateDrawState
import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public void updateDrawState(TextPaint tp) {
tp.setTypeface(mTypeface);
// Note: This flag is required for proper typeface rendering
tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
示例9: init
import android.text.TextPaint; //导入方法依赖的package包/类
private void init(AttributeSet attrs, int defStyle) {
// Load attributes
// final TypedArray a = getContext().obtainStyledAttributes(
// attrs, FrameLayoutWithHole, defStyle, 0);
//
//
// a.recycle();
setWillNotDraw(false);
// Set up a default TextPaint object
mTextPaint = new TextPaint();
mTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
mTextPaint.setTextAlign(Paint.Align.LEFT);
Point size = new Point();
size.x = mActivity.getResources().getDisplayMetrics().widthPixels;
size.y = mActivity.getResources().getDisplayMetrics().heightPixels;
mEraserBitmap = Bitmap.createBitmap(size.x, size.y, Bitmap.Config.ARGB_8888);
mEraserCanvas = new Canvas(mEraserBitmap);
mPaint = new Paint();
mPaint.setColor(0xcc000000);
transparentPaint = new Paint();
transparentPaint.setColor(getResources().getColor(android.R.color.transparent));
transparentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
mEraser = new Paint();
mEraser.setColor(0xFFFFFFFF);
mEraser.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
mEraser.setFlags(Paint.ANTI_ALIAS_FLAG);
Log.d("tourguide","getHeight: "+ size.y);
Log.d("tourguide","getWidth: " + size.x);
}
示例10: addPaintFlags
import android.text.TextPaint; //导入方法依赖的package包/类
public void addPaintFlags(TextPaint paint, boolean add, int flat) {
if (add) {
paint.setFlags(paint.getFlags() | flat);
} else {
paint.setFlags(paint.getFlags() & ~flat);
}
}
示例11: init
import android.text.TextPaint; //导入方法依赖的package包/类
private void init(AttributeSet attrs, int defStyle) {
final TypedArray a = getContext().obtainStyledAttributes(
attrs, R.styleable.ShapeLetter, defStyle, 0);
if(a.hasValue(R.styleable.ShapeLetter_letter)){
mTitleText = a.getString(R.styleable.ShapeLetter_letter);
}
mShape = a.getInteger(R.styleable.ShapeLetter_shape,DEFAULT_SHAPE);
mTitleColor = a.getColor(R.styleable.ShapeLetter_letter_color, DEFAULT_LETTER_COLOR);
mBackgroundColor = a.getColor(R.styleable.ShapeLetter_shape_color, DEFAULT_SHAPE_COLOR);
mTitleSize = a.getDimension(R.styleable.ShapeLetter_letter_size, DEFAULT_LETTER_SIZE);
a.recycle();
//Title TextPaint
mTitleTextPaint = new TextPaint();
mTitleTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
mTitleTextPaint.setTypeface(mFont);
mTitleTextPaint.setTextAlign(Paint.Align.CENTER);
mTitleTextPaint.setLinearText(true);
mTitleTextPaint.setColor(mTitleColor);
mTitleTextPaint.setTextSize(mTitleSize);
//Background Paint
mBackgroundPaint = new Paint();
mBackgroundPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
mBackgroundPaint.setStyle(Paint.Style.FILL);
mBackgroundPaint.setColor(mBackgroundColor);
mInnerRectF = new RectF();
}
示例12: updateMeasureState
import android.text.TextPaint; //导入方法依赖的package包/类
@Override public void updateMeasureState(TextPaint p) {
p.setTypeface(typeface);
p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
示例13: updateDrawState
import android.text.TextPaint; //导入方法依赖的package包/类
@Override public void updateDrawState(TextPaint tp) {
tp.setTypeface(typeface);
tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
示例14: DateLineView
import android.text.TextPaint; //导入方法依赖的package包/类
public DateLineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.context = context;
//虚线
linePaint = new Paint();
linePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
linePaint.setStyle(Paint.Style.STROKE);
linePaint.setColor(Color.WHITE);
linePaint.setStrokeWidth(3);
DashPathEffect effect = new DashPathEffect(new float[]{8, 8}, 0);
linePaint.setPathEffect(effect);
//文本
textPaint = new TextPaint();
textPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
textPaint.setTextSize(DensityUtils.sp2px(context, 10));
textPaint.setColor(Color.WHITE);
//圆点
circlePaint = new Paint();
circlePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
circlePaint.setStyle(Paint.Style.FILL);
circlePaint.setColor(Color.WHITE);
timeAxisList = new ArrayList<>();
TimeAxis day = new TimeAxis();
day.setDate("2017.09.12");
day.setName("端午");
day.setDays(0);
timeAxisList.add(day);
day = new TimeAxis();
day.setDate("2017.09.12");
day.setName("毕业");
day.setDays(10);
timeAxisList.add(day);
day = new TimeAxis();
day.setDate("2017.09.12");
day.setName("实习");
day.setDays(11);
timeAxisList.add(day);
day = new TimeAxis();
day.setDate("2017.09.12");
day.setName("暑假");
day.setDays(17);
timeAxisList.add(day);
}