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


Java TextPaint.setStrokeWidth方法代码示例

本文整理汇总了Java中android.text.TextPaint.setStrokeWidth方法的典型用法代码示例。如果您正苦于以下问题:Java TextPaint.setStrokeWidth方法的具体用法?Java TextPaint.setStrokeWidth怎么用?Java TextPaint.setStrokeWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.text.TextPaint的用法示例。


在下文中一共展示了TextPaint.setStrokeWidth方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDraw

import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    int restoreColor = this.getCurrentTextColor();
    if (strokeColor != null) {
        TextPaint paint = this.getPaint();
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeJoin(strokeJoin);
        paint.setStrokeMiter(strokeMiter);
        this.setTextColor(strokeColor);
        paint.setStrokeWidth(strokeWidth);
        super.onDraw(canvas);
        paint.setStyle(Paint.Style.FILL);
        this.setTextColor(restoreColor);
    }
}
 
开发者ID:AppHero2,项目名称:Raffler-Android,代码行数:18,代码来源:CustomTextView.java

示例2: initPaint

import android.text.TextPaint; //导入方法依赖的package包/类
private void initPaint() {

    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setTextSize(getTextSize());
    mTextPaint.setColor(mColor);
    mTextPaint.setStyle(Paint.Style.FILL);
    mTextPaint.setTypeface(getTypeface());

    mTextPaintOutline = new TextPaint();
    mTextPaintOutline.setAntiAlias(true);
    mTextPaintOutline.setTextSize(getTextSize());
    mTextPaintOutline.setColor(mBorderColor);
    mTextPaintOutline.setStyle(Paint.Style.STROKE);
    mTextPaintOutline.setTypeface(getTypeface());
    mTextPaintOutline.setStrokeWidth(mBorderSize);
  }
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:18,代码来源:OutlineTextView.java

示例3: initPaint

import android.text.TextPaint; //导入方法依赖的package包/类
private void initPaint() {
  mTextPaint = new TextPaint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(getTextSize());
  mTextPaint.setColor(mColor);
  mTextPaint.setStyle(Paint.Style.FILL);
  mTextPaint.setTypeface(getTypeface());

  mTextPaintOutline = new TextPaint();
  mTextPaintOutline.setAntiAlias(true);
  mTextPaintOutline.setTextSize(getTextSize());
  mTextPaintOutline.setColor(mBorderColor);
  mTextPaintOutline.setStyle(Paint.Style.STROKE);
  mTextPaintOutline.setTypeface(getTypeface());
  mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:17,代码来源:OutlineTextView.java

示例4: Settings

import android.text.TextPaint; //导入方法依赖的package包/类
public Settings(Sushi slidr) {
    this.slidr = slidr;

    paintBar = new Paint();
    paintBar.setAntiAlias(true);
    paintBar.setStrokeWidth(2);
    paintBar.setColor(colorBackground);

    paintTextTop = new TextPaint();
    paintTextTop.setAntiAlias(true);
    paintTextTop.setStyle(Paint.Style.FILL);
    paintTextTop.setColor(textColor);
    paintTextTop.setTextSize(dpToPx(textSize));

    paintTextBubble = new TextPaint();
    paintTextBubble.setAntiAlias(true);
    paintTextBubble.setStyle(Paint.Style.FILL);
    paintTextBubble.setColor(Color.WHITE);
    paintTextBubble.setStrokeWidth(2);
    paintTextBubble.setTextSize(dpToPx(textSizeBubble));

    paintBubble = new Paint();
    paintBubble.setAntiAlias(true);
    paintBubble.setStrokeWidth(3);
}
 
开发者ID:florent37,项目名称:android-slidr,代码行数:26,代码来源:Sushi.java

示例5: updateDrawState

import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public void updateDrawState(TextPaint paint) {
    final float newStrokeWidth = (mWeight / (UDFontWeight.WEIGHT_NORMAL_INT + 0.0f));
    if (paint.getStyle() == Paint.Style.FILL) {
        paint.setStyle(Paint.Style.FILL_AND_STROKE);
    }
    paint.setStrokeWidth(newStrokeWidth);
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:9,代码来源:WeightStyleSpan.java

示例6: PrimitiveDrawer

import android.text.TextPaint; //导入方法依赖的package包/类
public PrimitiveDrawer(Context context, AttributeSet attributeSet) {
    super(context, attributeSet);

    paint = new TextPaint();
    paint.setStyle(Paint.Style.FILL);
    paint.setAntiAlias(true);
    paint.setColor(0xffffffff);
    paint.setStrokeWidth(1.f);
    paint.setTextSize(35.f);
    paint.setTextAlign(Paint.Align.LEFT);
}
 
开发者ID:PacktPublishing,项目名称:Building-Android-UIs-with-Custom-Views,代码行数:12,代码来源:PrimitiveDrawer.java

示例7: onDraw

import android.text.TextPaint; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    Canvas c = canvas;
    if (mExternalSurface != null) {
        try {
            canvas.getClipBounds(r);
            getLocationOnScreen(location);
            r.offsetTo(location[0],location[1]);
            c = mExternalSurface.lockCanvas(null);
            c.save();
            c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
            c.clipRect(r);
            c.translate(location[0],location[1]);
        } catch (Exception ignored) {
        }
    }
    TextPaint paint = getPaint();
    int color = getCurrentTextColor();
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeJoin(Paint.Join.MITER);
    paint.setStrokeMiter(1.0f);
    paint.setStrokeWidth(4.0f);
    setTextColor(Color.BLACK);
    super.onDraw(c);
    paint.setStyle(Paint.Style.FILL);
    setTextColor(color);
    super.onDraw(c);
    if (c != canvas) {
        c.restore();
        mExternalSurface.unlockCanvasAndPost(c);
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:33,代码来源:SubtitleTextView.java

示例8: updateDrawState

import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public void updateDrawState(TextPaint tp) {
  if (mDrawStroke) {
    tp.setColor(mStrokeColor);
    tp.setStrokeCap(Paint.Cap.ROUND);
    tp.setStrokeWidth(mStrokeWidth);
    tp.setStyle(Paint.Style.STROKE);
  } else {
    tp.setColor(mTextColor);
    tp.setStyle(Paint.Style.FILL);
  }
}
 
开发者ID:lsjwzh,项目名称:FastTextView,代码行数:13,代码来源:StrokeSpan.java

示例9: Settings

import android.text.TextPaint; //导入方法依赖的package包/类
public Settings(Slidr slidr) {
    this.slidr = slidr;

    paintIndicator = new Paint();
    paintIndicator.setAntiAlias(true);
    paintIndicator.setStrokeWidth(2);

    paintBar = new Paint();
    paintBar.setAntiAlias(true);
    paintBar.setStrokeWidth(2);
    paintBar.setColor(colorBackground);

    paintStep = new Paint();
    paintStep.setAntiAlias(true);
    paintStep.setStrokeWidth(5);
    paintStep.setColor(colorStoppover);

    paintTextTop = new TextPaint();
    paintTextTop.setAntiAlias(true);
    paintTextTop.setStyle(Paint.Style.FILL);
    paintTextTop.setColor(textColor);
    paintTextTop.setTextSize(textTopSize);

    paintTextBottom = new TextPaint();
    paintTextBottom.setAntiAlias(true);
    paintTextBottom.setStyle(Paint.Style.FILL);
    paintTextBottom.setColor(textColor);
    paintTextBottom.setTextSize(textBottomSize);

    paintBubbleTextCurrent = new TextPaint();
    paintBubbleTextCurrent.setAntiAlias(true);
    paintBubbleTextCurrent.setStyle(Paint.Style.FILL);
    paintBubbleTextCurrent.setColor(Color.WHITE);
    paintBubbleTextCurrent.setStrokeWidth(2);
    paintBubbleTextCurrent.setTextSize(dpToPx(textSizeBubbleCurrent));

    paintBubble = new Paint();
    paintBubble.setAntiAlias(true);
    paintBubble.setStrokeWidth(3);
}
 
开发者ID:florent37,项目名称:android-slidr,代码行数:41,代码来源:Slidr.java

示例10: AndroidDisplayer

import android.text.TextPaint; //导入方法依赖的package包/类
public AndroidDisplayer() {
    PAINT = new TextPaint();
    PAINT.setStrokeWidth(STROKE_WIDTH);
    PAINT_DUPLICATE = new TextPaint(PAINT);
    ALPHA_PAINT = new Paint();
    UNDERLINE_PAINT = new Paint();
    UNDERLINE_PAINT.setStrokeWidth(UNDERLINE_HEIGHT);
    UNDERLINE_PAINT.setStyle(Style.STROKE);
    BORDER_PAINT = new Paint();
    BORDER_PAINT.setStyle(Style.STROKE);
    BORDER_PAINT.setStrokeWidth(BORDER_WIDTH);
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:13,代码来源:AndroidDisplayer.java

示例11: CandidateView

import android.text.TextPaint; //导入方法依赖的package包/类
/**
 * Construct a CandidateView for showing suggested words for completion.
 * @param context context
 */
public CandidateView(Context context) {
    super(context);
    mService = (QuranKeyboardIME) context;

    mSelectionHighlight = ContextCompat.getDrawable(context,
            android.R.drawable.list_selector_background);
    mSelectionHighlight.setState(new int[] {
            android.R.attr.state_enabled,
            android.R.attr.state_focused,
            android.R.attr.state_window_focused,
            android.R.attr.state_pressed
    });

    Resources r = context.getResources();
    
    setBackgroundColor(ContextCompat.getColor(context, R.color.candidate_background));
    
    mColorNormal = ContextCompat.getColor(context, R.color.candidate_normal);
    mColorRecommended = ContextCompat.getColor(context, R.color.candidate_recommended);
    mColorOther = ContextCompat.getColor(context, R.color.candidate_other);
    mVerticalPadding = r.getDimensionPixelSize(R.dimen.candidate_vertical_padding);

    mPaint = new TextPaint();
    mPaint.setColor(mColorNormal);
    mPaint.setAntiAlias(true);
    mPaint.setTextSize(r.getDimensionPixelSize(R.dimen.candidate_font_height));
    mPaint.setStrokeWidth(0);
    mDefaultTf = mPaint.getTypeface();
    mUthamniTf = mService.getUthmaniTypeFace();

    mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public boolean onScroll(MotionEvent e1, MotionEvent e2,
                float distanceX, float distanceY) {
            mScrolled = true;
            int sx = getScrollX();
            sx += distanceX;
            if (sx < 0) {
                sx = 0;
            }
            if (sx + getWidth() > mTotalWidth) {                    
                sx -= distanceX;
            }
            mTargetScrollX = sx;
            scrollTo(sx, getScrollY());
            invalidate();
            return true;
        }
    });
    setHorizontalFadingEdgeEnabled(true);
    setWillNotDraw(false);
    setHorizontalScrollBarEnabled(false);
    setVerticalScrollBarEnabled(false);
}
 
开发者ID:cdjalel,项目名称:QuranKeyboard,代码行数:59,代码来源:CandidateView.java


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