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