當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。