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


Java Paint.setTextAlign方法代码示例

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


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

示例1: NewBookFactory

import android.graphics.Paint; //导入方法依赖的package包/类
public NewBookFactory(ChaptersResponse.MixToc chaptersInfo){
    cacheManager = CacheManager.getInstance();

    EventBus.getDefault().register(this);

    this.mChaptersInfo = chaptersInfo;
    getWidthAndHeight();
    normalPaint = new Paint();
    normalPaint.setTextSize(fontSize);
    normalPaint.setColor(Color.BLACK);
    normalPaint.setTextAlign(Paint.Align.LEFT);

    titlePaint = new Paint();
    titlePaint.setTextSize(titleSize);
    titlePaint.setColor(Color.DKGRAY);
    titlePaint.setTextAlign(Paint.Align.CENTER);
    titlePaint.setTypeface(Typeface.DEFAULT_BOLD);

    contentWidth = width - 2 * normalMargin;
    contentHeight = height - 2 * normalMargin;
    lineCount = contentHeight / (fontSize + normalMargin);

    backgroundBitmap = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.bg_read);
}
 
开发者ID:1014277960,项目名称:DailyReader,代码行数:25,代码来源:NewBookFactory.java

示例2: initPaint

import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaint(){
    mRingPaint = new Paint();
    mRingPaint.setStyle(Paint.Style.FILL);
    mRingPaint.setAntiAlias(true);

    mLinePaint = new Paint();
    mLinePaint.setStyle(Paint.Style.STROKE);
    mLinePaint.setAntiAlias(true);
    mLinePaint.setColor(Color.WHITE);
    mLinePaint.setStrokeWidth(4);

    mTextPaint = new Paint();
    mTextPaint.setTextSize(40);
    mTextPaint.setColor(Color.BLACK);
    mTextPaint.setAntiAlias(true);
    mTextPaint.setTextAlign(Paint.Align.CENTER);
    fontMetrics = mTextPaint.getFontMetrics();

    mDownTextPaint = new Paint();
    mDownTextPaint.setTextSize(80);
    mDownTextPaint.setColor(Color.parseColor("#ff9933"));
    mDownTextPaint.setAntiAlias(true);
    mDownTextPaint.setTextAlign(Paint.Align.CENTER);
    mDownTextPaint.setStrokeWidth(10);
    mDownTextPaint.setStrokeCap(Paint.Cap.ROUND);
}
 
开发者ID:android-jian,项目名称:efficientclock,代码行数:27,代码来源:EfficientClock.java

示例3: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {
    ateKey = Helper.getATEKey(getContext());
    accentColor = Config.accentColor(getContext(), ateKey);
    textPaint = new Paint();
    textPaint.setColor(labelColor);
    textPaint.setStyle(Paint.Style.FILL);
    textPaint.setTextSize(labelSize);
    textPaint.setFakeBoldText(true);
    textPaint.setTextAlign(Paint.Align.CENTER);
    circlePaint = new Paint();
    circlePaint.setColor(progressSecondaryColor);
    circlePaint.setStrokeWidth(progressSecondaryStrokeWidth);
    circlePaint.setStyle(Paint.Style.FILL);
    circlePaint2 = new Paint();
    circlePaint2.setColor(accentColor);
    circlePaint2.setTextAlign(Paint.Align.CENTER);
    circlePaint2.setStrokeWidth(progressPrimaryStrokeWidth);
    circlePaint2.setStyle(Paint.Style.FILL);
    linePaint = new Paint();
    linePaint.setColor(indicatorColor);
    linePaint.setStrokeWidth(indicatorWidth);

    oval = new RectF();

}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:26,代码来源:EqView.java

示例4: BookFactory

import android.graphics.Paint; //导入方法依赖的package包/类
public BookFactory(ChaptersResponse.MixToc chaptersInfo){
    this.mChaptersInfo = chaptersInfo;
    getWidthAndHeight();
    mNormalPaint = new Paint();
    mNormalPaint.setTextSize(mNormalSize);
    mNormalPaint.setColor(Color.BLACK);
    mNormalPaint.setTextAlign(Paint.Align.LEFT);

    mTitlePaint = new Paint();
    mTitlePaint.setTextSize(mTitleSize);
    mTitlePaint.setColor(Color.DKGRAY);
    mTitlePaint.setTextAlign(Paint.Align.CENTER);
    mTitlePaint.setTypeface(Typeface.DEFAULT_BOLD);

    mCurrentPage = 0;
    mBackgroundBitmap = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.bg_read);
}
 
开发者ID:1014277960,项目名称:DailyReader,代码行数:18,代码来源:BookFactory.java

示例5: TabSwitcherDrawable

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * Creates a new drawable, which allows to display the number of tabs, which are currently
 * contained by a {@link TabSwitcher}.
 *
 * @param context
 *         The context, which should be used by the drawable, as an instance of the class {@link
 *         Context}. The context may not be null
 */
public TabSwitcherDrawable(@NonNull final Context context) {
    ensureNotNull(context, "The context may not be null");
    Resources resources = context.getResources();
    size = resources.getDimensionPixelSize(R.dimen.tab_switcher_drawable_size);
    textSizeNormal =
            resources.getDimensionPixelSize(R.dimen.tab_switcher_drawable_font_size_normal);
    textSizeSmall =
            resources.getDimensionPixelSize(R.dimen.tab_switcher_drawable_font_size_small);
    background = ContextCompat.getDrawable(context, R.drawable.tab_switcher_drawable_background)
            .mutate();
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(Color.WHITE);
    paint.setTextAlign(Align.CENTER);
    paint.setTextSize(textSizeNormal);
    paint.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD));
    label = Integer.toString(0);
    int tint = ThemeUtil.getColor(context, android.R.attr.textColorPrimary);
    setColorFilter(tint, PorterDuff.Mode.MULTIPLY);
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:28,代码来源:TabSwitcherDrawable.java

示例6: initPaintTools

import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaintTools() {

    satValPaint = new Paint();
    satValTrackerPaint = new Paint();
    hueAlphaTrackerPaint = new Paint();
    alphaPaint = new Paint();
    alphaTextPaint = new Paint();
    borderPaint = new Paint();

    satValTrackerPaint.setStyle(Style.STROKE);
    satValTrackerPaint.setStrokeWidth(DrawingUtils.dpToPx(getContext(), 2));
    satValTrackerPaint.setAntiAlias(true);

    hueAlphaTrackerPaint.setColor(sliderTrackerColor);
    hueAlphaTrackerPaint.setStyle(Style.STROKE);
    hueAlphaTrackerPaint.setStrokeWidth(DrawingUtils.dpToPx(getContext(), 2));
    hueAlphaTrackerPaint.setAntiAlias(true);

    alphaTextPaint.setColor(0xff1c1c1c);
    alphaTextPaint.setTextSize(DrawingUtils.dpToPx(getContext(), 14));
    alphaTextPaint.setAntiAlias(true);
    alphaTextPaint.setTextAlign(Align.CENTER);
    alphaTextPaint.setFakeBoldText(true);

  }
 
开发者ID:tateisu,项目名称:SubwayTooter,代码行数:26,代码来源:ColorPickerView.java

示例7: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init(String maxLengthText) {
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setStrokeWidth(1);
    mPaint.setTextAlign(Paint.Align.CENTER);
    mPaint.setTextSize(mIndicatorTextSize);
    Rect mRect = new Rect();
    mPaint.getTextBounds(maxLengthText, 0, maxLengthText.length(), mRect);
    mIndicatorWidth = mRect.width() + IndicatorUtils.dp2px(mContext, 4);
    int minWidth = IndicatorUtils.dp2px(mContext, 36);
    if (mIndicatorWidth < minWidth) {
        mIndicatorWidth = minWidth;
    }
    mTextHeight = mRect.height();
    mIndicatorHeight = mIndicatorWidth * 1.2f;
    initPath();
}
 
开发者ID:warkiz,项目名称:IndicatorSeekBar,代码行数:18,代码来源:CircleBubbleView.java

示例8: setPaintStyle

import android.graphics.Paint; //导入方法依赖的package包/类
private void setPaintStyle() {
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    if (currentStyle == 1) {
        mPaint.setStrokeWidth(currentSize);
        mPaint.setColor(currentColor);
    } else {
        mPaint.setAlpha(0);
        mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
        mPaint.setColor(Color.TRANSPARENT);
        mPaint.setStrokeWidth(50);
    }

    mMaskPaint = new Paint();
    mMaskPaint.setStrokeWidth(3);
    mMaskPaint.setTextAlign(Paint.Align.RIGHT);
    mMaskPaint.setColor(Color.GREEN);
    mMaskPaint.setTextSize(40);
}
 
开发者ID:liuke2016,项目名称:filepicker,代码行数:24,代码来源:TuyaView.java

示例9: drawKeyPopupHint

import android.graphics.Paint; //导入方法依赖的package包/类
protected void drawKeyPopupHint(@Nonnull final Key key, @Nonnull final Canvas canvas,
        @Nonnull final Paint paint, @Nonnull final KeyDrawParams params) {
    if (TextUtils.isEmpty(mKeyPopupHintLetter)) {
        return;
    }
    final int keyWidth = key.getDrawWidth();
    final int keyHeight = key.getHeight();

    paint.setTypeface(params.mTypeface);
    paint.setTextSize(params.mHintLetterSize);
    paint.setColor(params.mHintLabelColor);
    paint.setTextAlign(Align.CENTER);
    final float hintX = keyWidth - mKeyHintLetterPadding
            - TypefaceUtils.getReferenceCharWidth(paint) / 2.0f;
    final float hintY = keyHeight - mKeyPopupHintLetterPadding;
    canvas.drawText(mKeyPopupHintLetter, hintX, hintY, paint);
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:18,代码来源:KeyboardView.java

示例10: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {
    timer = new Timer();
    mDataList = new ArrayList<String>();
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Style.FILL);
    mPaint.setTextAlign(Align.CENTER);
    mPaint.setColor(mColorText);
}
 
开发者ID:Horrarndoo,项目名称:YiZhi,代码行数:9,代码来源:PickerView.java

示例11: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {
    timer = new Timer();
    mDataList = new ArrayList<T>();
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Style.FILL);
    mPaint.setTextAlign(Align.CENTER);
    mPaint.setColor(mColorText);
}
 
开发者ID:yhyzgn,项目名称:Widgets,代码行数:9,代码来源:PickerView.java

示例12: _getTextPaint

import android.graphics.Paint; //导入方法依赖的package包/类
protected Paint _getTextPaint(float fontSizeScale) {
	XulRenderContext ctx = _render.getRenderContext();
	Paint defPaint = ctx.getTextPaintByName(_fontFace);

	if (!(_fontShadowSize == 0 || (_fontShadowColor & 0xFF000000) == 0)) {
		defPaint = ctx.getShadowTextPaintByName(_fontFace);
		defPaint.setShadowLayer(_fontShadowSize, _fontShadowX, _fontShadowY, _fontShadowColor);
	}

	defPaint.setColor(_fontColor);
	if (Math.abs(fontSizeScale - 1.0f) > 0.01f) {
		defPaint.setTextSize(_fontSize * fontSizeScale);
	} else {
		defPaint.setTextSize(_fontSize);
	}

	if (_fontWeight > 1.0) {
		if (_fontWeight > 2.5) {
			defPaint.setStrokeWidth(_fontWeight*fontSizeScale/2);
		} else {
			defPaint.setFakeBoldText(true);
		}
	} else {
		defPaint.setFakeBoldText(false);
	}
	defPaint.setTextScaleX(_fontScaleX);
	defPaint.setUnderlineText(_fontUnderline);
	defPaint.setStrikeThruText(_fontStrikeThrough);
	defPaint.setTextSkewX(_fontItalic ? -0.25f : 0);
	defPaint.setTextAlign(Paint.Align.LEFT);
	return defPaint;
}
 
开发者ID:starcor-company,项目名称:starcor.xul,代码行数:33,代码来源:XulBasicTextRenderer.java

示例13: setupView

import android.graphics.Paint; //导入方法依赖的package包/类
private void setupView() {
    linePaint = new Paint();
    linePaint.setAntiAlias(true);//抗锯齿
    linePaint.setStyle(Paint.Style.STROKE);//STROKE描边FILL填充
    linePaint.setColor(lineColor);
    linePaint.setStrokeWidth(dip2px(lineWidthDP));//边框宽度

    pointPaint = new Paint();
    pointPaint.setAntiAlias(true);
    pointPaint.setStyle(Paint.Style.FILL);
    pointPaint.setColor(pointColor);
    pointPaint.setStrokeWidth(dip2px(pointWidthDP));

    tablePaint = new Paint();
    tablePaint.setAntiAlias(true);
    tablePaint.setStyle(Paint.Style.STROKE);
    tablePaint.setColor(tableColor);
    tablePaint.setStrokeWidth(dip2px(tableWidthDP));

    textRulerPaint = new Paint();
    textRulerPaint.setAntiAlias(true);
    textRulerPaint.setStyle(Paint.Style.FILL);
    textRulerPaint.setTextAlign(Paint.Align.CENTER);
    textRulerPaint.setColor(rulerTextColor);//文本颜色
    textRulerPaint.setTextSize(sp2px(rulerTextSizeSP));//字体大小

    textPointPaint = new Paint();
    textPointPaint.setAntiAlias(true);
    textPointPaint.setStyle(Paint.Style.FILL);
    textPointPaint.setTextAlign(Paint.Align.CENTER);
    textPointPaint.setColor(pointTextColor);//文本颜色
    textPointPaint.setTextSize(sp2px(pointTextSizeSP));//字体大小

    linePath = new Path();
    tablePath = new Path();

    resetParam();
}
 
开发者ID:jeanboydev,项目名称:Android-LineChart,代码行数:39,代码来源:LineChartView.java

示例14: preparePaint

import android.graphics.Paint; //导入方法依赖的package包/类
@Override
void preparePaint() {
    //Set title paint
    mTitlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTitlePaint.setColor(mTitleColor);
    mTitlePaint.setTextAlign(Paint.Align.CENTER);
    mTitlePaint.setTextSize(getContext().getResources().getDimension(R.dimen.lib_title_text_size));
}
 
开发者ID:kevalpatel2106,项目名称:PasscodeView,代码行数:9,代码来源:BoxTitle.java

示例15: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs) {
    TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs,
            R.styleable.CanvasBoardView, 0, 0);
    playerUser = typedArray.getString(R.styleable.CanvasBoardView_playerUser);
    playerComputer = typedArray.getString(R.styleable.CanvasBoardView_playerComputer);
    computerStoneColor = typedArray.getString(R.styleable.CanvasBoardView_computerStoneColor);
    userStoneColor = typedArray.getString(R.styleable.CanvasBoardView_userStoneColor);
    maximumInitialStones =
            typedArray.getInt(R.styleable.CanvasBoardView_maximumInitialStones, 8);
    stoneRadius = typedArray.getInt(R.styleable.CanvasBoardView_stoneRadius, 20);
    canvasMargin = typedArray.getInt(R.styleable.CanvasBoardView_margin, 20);
    userStonePaint = new Paint();
    userStonePaint.setAntiAlias(true);
    userStonePaint.setDither(true);
    userStonePaint.setColor(Color.parseColor(userStoneColor));
    userStonePaint.setStrokeWidth(stoneRadius);

    computerStonePaint = new Paint();
    computerStonePaint.setAntiAlias(true);
    computerStonePaint.setDither(true);
    computerStonePaint.setColor(Color.parseColor(computerStoneColor));
    computerStonePaint.setStrokeWidth(stoneRadius);

    pickedStonePaint = new Paint();
    pickedStonePaint.setAntiAlias(true);
    pickedStonePaint.setDither(true);
    pickedStonePaint.setColor(Color.parseColor("#8C8C8C"));
    pickedStonePaint.setStrokeWidth(stoneRadius);

    boardPaint = new Paint();
    boardPaint.setAntiAlias(true);
    boardPaint.setDither(true);
    boardPaint.setColor(ContextCompat.getColor(context, R.color.colorAccent));
    boardPaint.setStyle(Paint.Style.STROKE);
    boardPaint.setStrokeJoin(Paint.Join.ROUND);
    boardPaint.setStrokeWidth(4);

    tripletPath = new Path();

    displayMessagePaint = new Paint();
    displayMessagePaint.setAntiAlias(true);
    displayMessagePaint.setTextAlign(Paint.Align.CENTER);
    displayMessagePaint.setTextSize(2 * canvasMargin);
    displayMessagePaint.setColor(Color.parseColor(computerStoneColor));

    scoreMessagePaint = new Paint();
    scoreMessagePaint.setAntiAlias(true);
    scoreMessagePaint.setTextAlign(Paint.Align.CENTER);
    scoreMessagePaint.setTextSize((float) 1.5 * canvasMargin);
    scoreMessagePaint.setColor(Color.parseColor(userStoneColor));

    tripletPaint = new Paint();
    tripletPaint.setAntiAlias(true);
    tripletPaint.setStyle(Paint.Style.STROKE);
    tripletPaint.setColor(Color.parseColor(computerStoneColor));
    tripletPaint.setStrokeWidth(5);

    typedArray.recycle();

    settingsPreferences = PreferenceManager.getDefaultSharedPreferences(context);

    // 24 junctions starting from 1 to 24
    junctionsArray = new Junction[25];

    gameUtility = new GameUtility();
    this.context = context;
    vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    mediaPlayer = MediaPlayer.create(context, R.raw.served);
}
 
开发者ID:varunon9,项目名称:Fitto,代码行数:70,代码来源:CanvasBoardView.java


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