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


Java Paint.SUBPIXEL_TEXT_FLAG属性代码示例

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


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

示例1: GifBadge

GifBadge(Context context) {
    if (bitmap == null) {
        final DisplayMetrics dm = context.getResources().getDisplayMetrics();
        final float density = dm.density;
        final float scaledDensity = dm.scaledDensity;
        final TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint
                .SUBPIXEL_TEXT_FLAG);
        textPaint.setTypeface(Typeface.create(TYPEFACE, TYPEFACE_STYLE));
        textPaint.setTextSize(TEXT_SIZE * scaledDensity);

        final float padding = PADDING * density;
        final float cornerRadius = CORNER_RADIUS * density;
        final Rect textBounds = new Rect();
        textPaint.getTextBounds(GIF, 0, GIF.length(), textBounds);
        height = (int) (padding + textBounds.height() + padding);
        width = (int) (padding + textBounds.width() + padding);
        bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        bitmap.setHasAlpha(true);
        final Canvas canvas = new Canvas(bitmap);
        final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        backgroundPaint.setColor(BACKGROUND_COLOR);
        canvas.drawRoundRect(0, 0, width, height, cornerRadius, cornerRadius,
                backgroundPaint);
        // punch out the word 'GIF', leaving transparency
        textPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
        canvas.drawText(GIF, padding, height - padding, textPaint);
    }
    paint = new Paint();
}
 
开发者ID:gejiaheng,项目名称:Protein,代码行数:29,代码来源:BadgedFourThreeImageView.java

示例2: QMUICollapsingTextHelper

public QMUICollapsingTextHelper(View view) {
    mView = view;

    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    mCollapsedBounds = new Rect();
    mExpandedBounds = new Rect();
    mCurrentBounds = new RectF();
}
 
开发者ID:coopese,项目名称:qmui,代码行数:9,代码来源:QMUICollapsingTextHelper.java

示例3: CollapsingTextHelper

public CollapsingTextHelper(View view) {
  mView = view;

  mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

  mCollapsedBounds = new Rect();
  mExpandedBounds = new Rect();
  mCurrentBounds = new RectF();
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:9,代码来源:CollapsingTextHelper.java

示例4: StaticLabelTextInputLayout

public StaticLabelTextInputLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    mTextPaint.setTypeface(getTypeface());
    mTextPaint.setTextSize(getResources().getDimensionPixelSize(R.dimen.abc_text_size_caption_material));
    StyledAttributesHelper ta = StyledAttributesHelper.obtainStyledAttributes(context,
            new int[] { android.R.attr.textColorHint });
    mTextColorUnfocused = ta.getColor(android.R.attr.textColorHint, 0);
    ta.recycle();
    mTextColorFocused = ThemeHelper.getAccentColor(context);
    mTextPaint.setColor(mTextColorUnfocused);
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:13,代码来源:StaticLabelTextInputLayout.java

示例5: LabelLayout

public LabelLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    setWillNotDraw(false);
    setAddStatesFromChildren(true);

    mInputFrame = new FrameLayout(context);
    mInputFrame.setAddStatesFromChildren(true);
    super.addView(mInputFrame, -1, generateDefaultLayoutParams());

    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    mTextPaint.setTypeface(Typeface.DEFAULT);// getTypeface());
    mTextSizeCollapsed = getResources().getDimensionPixelSize(R.dimen.abc_text_size_caption_material);
    mTextSizeExpanded = getResources().getDimensionPixelSize(R.dimen.abc_text_size_medium_material);
    mTextPaint.setTextSize(mTextSizeCollapsed);

    StyledAttributesHelper ta = StyledAttributesHelper.obtainStyledAttributes(context, attrs,
            new int[] { R.attr.doNotExpand, android.R.attr.hint, android.R.attr.textColorHint });
    try {
        mDoNotExpand = ta.getBoolean(R.attr.doNotExpand, false);
        mHint = ta.getString(android.R.attr.hint);
        mTextColorUnfocused = ta.getColorStateList(android.R.attr.textColorHint);
    } finally {
        ta.recycle();
    }
    mTextColorFocused = ThemeHelper.getAccentColor(context);
    mTextPaint.setColor(mTextColorUnfocused.getColorForState(getDrawableState(), mTextColorUnfocused.getDefaultColor()));

    mAnimator = ValueAnimator.ofFloat(0.f, 1.f);
    mAnimator.setInterpolator(new LinearInterpolator());
    mAnimator.setDuration(200);
    mAnimator.addUpdateListener((ValueAnimator animation) -> {
        mAnimState = (float) animation.getAnimatedValue();
        invalidate();
    });

    updateTopMargin();
    updateTextPositions();
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:39,代码来源:LabelLayout.java

示例6: setTypeface

public final void setTypeface(TextView target, Typeface t) {
    if (t == null) return;
    int flags = target.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG;
    target.setPaintFlags(flags);
    target.setTypeface(t);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:MaterialDialog.java


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