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


Java TextPaint.setAlpha方法代码示例

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


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

示例1: SlidingLocaleDrawable

import android.text.TextPaint; //导入方法依赖的package包/类
@SuppressLint("ResourceAsColor")
public SlidingLocaleDrawable(Drawable background, int width, int height) {
          mBackground = background;
          setDefaultBounds(mBackground);
          mWidth = width;
          mHeight = height;
          mTextPaint = new TextPaint();
          mTextPaint.setTextSize(getTextSizeFromTheme(android.R.style.TextAppearance_Medium, 18));
          
          mTextPaint.setColor(R.color.latinkeyboard_transparent);
          mTextPaint.setTextAlign(Align.CENTER);
          mTextPaint.setAlpha(OPACITY_FULLY_OPAQUE);
          mTextPaint.setAntiAlias(true);
          mMiddleX = (mWidth - mBackground.getIntrinsicWidth()) / 2;
          mLeftDrawable =
                  mRes.getDrawable(R.drawable.sym_keyboard_feedback_language_arrows_left);
          mRightDrawable =
                  mRes.getDrawable(R.drawable.sym_keyboard_feedback_language_arrows_right);
          mThreshold = ViewConfiguration.get(mContext).getScaledTouchSlop();
      }
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:21,代码来源:LatinKeyboard.java

示例2: getOverlayBitmap

import android.text.TextPaint; //导入方法依赖的package包/类
public static Bitmap getOverlayBitmap(Context context, Bitmap bitmap, String text) {
    Bitmap result = bitmap.copy(bitmap.getConfig(), true);
    float scale = context.getResources().getDisplayMetrics().density;
    Canvas canvas = new Canvas(result);
    TextPaint mTextPaint = new TextPaint();
    mTextPaint.setTextSize((int) (16 * scale));
    mTextPaint.setColor(Color.RED);
    mTextPaint.setAlpha(38);
    StaticLayout mTextLayout = new StaticLayout(text, mTextPaint, canvas.getWidth() + 700, Layout.Alignment.ALIGN_CENTER, 1.1f, 0.3f, true);
    canvas.save();

    float textX = -200;
    float textY = -10;

    canvas.translate(textX, textY);
    mTextLayout.draw(canvas);
    canvas.restore();
    return result;
}
 
开发者ID:SinsangMarket,项目名称:ASS,代码行数:20,代码来源:Util.java

示例3: getOverlayBitmap2

import android.text.TextPaint; //导入方法依赖的package包/类
public static Bitmap getOverlayBitmap2(Context context, Bitmap bitmap, String text) {
    Bitmap result = bitmap.copy(bitmap.getConfig(), true);
    float scale = context.getResources().getDisplayMetrics().density;
    Canvas canvas = new Canvas(result);

    TextPaint mTextPaint = new TextPaint();
    mTextPaint.setTextSize((int) (12 * scale));
    mTextPaint.setColor(Color.WHITE);
    mTextPaint.setAlpha(204);
    mTextPaint.setShadowLayer(5f, 0f, 1f, Color.DKGRAY);

    StaticLayout mTextLayout = new StaticLayout(text, mTextPaint, canvas.getWidth() - Util.dpToPx(87), Layout.Alignment.ALIGN_CENTER, 1.0f, 0.3f, true);
    canvas.save();

    float textX = (canvas.getWidth() / 2) - (mTextLayout.getWidth() / 2);
    float textY = result.getHeight() - Util.dpToPx(72);

    canvas.translate(textX, textY);
    mTextLayout.draw(canvas);
    canvas.restore();
    return result;
}
 
开发者ID:SinsangMarket,项目名称:ASS,代码行数:23,代码来源:Util.java

示例4: initPaint

import android.text.TextPaint; //导入方法依赖的package包/类
private void initPaint() {
    mPathEffect = new DashPathEffect(new float[]{dp2, dp2}, 1);
    mGradeAxisPaint = new Paint();
    mGradeAxisPaint.reset();
    mGradeAxisPaint.setStyle(Paint.Style.STROKE);
    mGradeAxisPaint.setStrokeWidth(1);
    mGradeAxisPaint.setColor(isDebug ? Color.parseColor("#f00000") : Color.parseColor("#16ffffff"));
    mGradeAxisPaint.setAntiAlias(true);
    mGradeAxisPaint.setPathEffect(mPathEffect);

    mChartPaint = new Paint();
    mChartPaint.setStyle(Paint.Style.FILL);
    mChartPaint.setStrokeWidth(4);
    mChartPaint.setAntiAlias(true);

    mChartTestLinePaint = new Paint();
    mChartTestLinePaint.setStyle(Paint.Style.STROKE);
    mChartTestLinePaint.setStrokeWidth(dp2px(1));
    mChartTestLinePaint.setColor(Color.parseColor("#DF6A56"));
    mChartTestLinePaint.setAntiAlias(true);
    mChartTestLinePaint.setAlpha(0);
    if (isDebug) {
        mChartTestLinePaint.setAlpha(255);
    }

    mChartIndicatorPaint = new Paint();
    mChartIndicatorPaint.setStyle(Paint.Style.STROKE);
    mChartIndicatorPaint.setStrokeWidth(dp2px(1));

    mWhitePaint = new Paint();
    mWhitePaint.setStyle(Paint.Style.FILL);
    mWhitePaint.setColor(Color.parseColor("#ffffff"));

    mWhiteTextPaint = new TextPaint();
    mWhiteTextPaint.setColor(Color.parseColor("#ffffff"));
    mWhiteTextPaint.setTextSize(dp2px(11));
    mWhiteTextPaint.setAntiAlias(true);

    mWhiteTextPaintHeight = mWhiteTextPaint.descent() + mWhiteTextPaint.ascent();

    mDarkTextPaint = new TextPaint(mWhiteTextPaint);
    mDarkTextPaint.setAlpha(127);

    mPathIndicatorLine = new Path();
    mPathIndicatorLine.setFillType(Path.FillType.WINDING);

    mPathGradLine = new Path();
    mRectIndicator = new RectF();
}
 
开发者ID:maoruibin,项目名称:TrendChartView,代码行数:50,代码来源:TrendChartView.java


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