本文整理汇总了Java中android.graphics.Paint.Align类的典型用法代码示例。如果您正苦于以下问题:Java Align类的具体用法?Java Align怎么用?Java Align使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Align类属于android.graphics.Paint包,在下文中一共展示了Align类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initPaintTools
import android.graphics.Paint.Align; //导入依赖的package包/类
private void initPaintTools() {
mSatValPaint = new Paint();
mSatValTrackerPaint = new Paint();
mHuePaint = new Paint();
mHueTrackerPaint = new Paint();
mAlphaPaint = new Paint();
mAlphaTextPaint = new Paint();
mBorderPaint = new Paint();
mSatValTrackerPaint.setStyle(Style.STROKE);
mSatValTrackerPaint.setStrokeWidth(2f * mDensity);
mSatValTrackerPaint.setAntiAlias(true);
mHueTrackerPaint.setColor(mSliderTrackerColor);
mHueTrackerPaint.setStyle(Style.STROKE);
mHueTrackerPaint.setStrokeWidth(2f * mDensity);
mHueTrackerPaint.setAntiAlias(true);
mAlphaTextPaint.setColor(0xff1c1c1c);
mAlphaTextPaint.setTextSize(14f * mDensity);
mAlphaTextPaint.setAntiAlias(true);
mAlphaTextPaint.setTextAlign(Align.CENTER);
mAlphaTextPaint.setFakeBoldText(true);
}
示例2: AbstractChartRenderer
import android.graphics.Paint.Align; //导入依赖的package包/类
public AbstractChartRenderer(Context context, Chart chart) {
this.density = context.getResources().getDisplayMetrics().density;
this.scaledDensity = context.getResources().getDisplayMetrics().scaledDensity;
this.chart = chart;
this.computator = chart.getChartComputator();
labelMargin = ChartUtils.dp2px(density, DEFAULT_LABEL_MARGIN_DP);
labelOffset = labelMargin;
labelPaint.setAntiAlias(true);
labelPaint.setStyle(Paint.Style.FILL);
labelPaint.setTextAlign(Align.LEFT);
labelPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
labelPaint.setColor(Color.WHITE);
labelBackgroundPaint.setAntiAlias(true);
labelBackgroundPaint.setStyle(Paint.Style.FILL);
}
示例3: initAxisTextAlignment
import android.graphics.Paint.Align; //导入依赖的package包/类
private void initAxisTextAlignment(Axis axis, int position) {
namePaintTab[position].setTextAlign(Align.CENTER);
if (TOP == position || BOTTOM == position) {
labelPaintTab[position].setTextAlign(Align.CENTER);
} else if (LEFT == position) {
if (axis.isInside()) {
labelPaintTab[position].setTextAlign(Align.LEFT);
} else {
labelPaintTab[position].setTextAlign(Align.RIGHT);
}
} else if (RIGHT == position) {
if (axis.isInside()) {
labelPaintTab[position].setTextAlign(Align.RIGHT);
} else {
labelPaintTab[position].setTextAlign(Align.LEFT);
}
}
}
示例4: DataRenderer
import android.graphics.Paint.Align; //导入依赖的package包/类
public DataRenderer(ChartAnimator animator, ViewPortHandler viewPortHandler) {
super(viewPortHandler);
this.mAnimator = animator;
mRenderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mRenderPaint.setStyle(Style.FILL);
mDrawPaint = new Paint(Paint.DITHER_FLAG);
mValuePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mValuePaint.setColor(Color.rgb(63, 63, 63));
mValuePaint.setTextAlign(Align.CENTER);
mValuePaint.setTextSize(Utils.convertDpToPixel(9f));
mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mHighlightPaint.setStyle(Paint.Style.STROKE);
mHighlightPaint.setStrokeWidth(2f);
mHighlightPaint.setColor(Color.rgb(255, 187, 115));
}
示例5: PieChartRenderer
import android.graphics.Paint.Align; //导入依赖的package包/类
public PieChartRenderer(Context context, Chart chart, PieChartDataProvider dataProvider) {
super(context, chart);
this.dataProvider = dataProvider;
this.touchAdditional = ChartUtils.dp2px(this.density, 8);
this.slicePaint.setAntiAlias(true);
this.slicePaint.setStyle(Style.FILL);
this.centerCirclePaint.setAntiAlias(true);
this.centerCirclePaint.setStyle(Style.FILL);
this.centerCirclePaint.setXfermode(new PorterDuffXfermode(Mode.SRC));
this.centerCircleText1Paint.setAntiAlias(true);
this.centerCircleText1Paint.setTextAlign(Align.CENTER);
this.centerCircleText2Paint.setAntiAlias(true);
this.centerCircleText2Paint.setTextAlign(Align.CENTER);
this.separationLinesPaint.setAntiAlias(true);
this.separationLinesPaint.setStyle(Style.STROKE);
this.separationLinesPaint.setStrokeCap(Cap.ROUND);
this.separationLinesPaint.setXfermode(new PorterDuffXfermode(Mode.CLEAR));
this.separationLinesPaint.setColor(0);
}
示例6: drawKeyPopupHint
import android.graphics.Paint.Align; //导入依赖的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);
}
示例7: initPaintTools
import android.graphics.Paint.Align; //导入依赖的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);
}
示例8: initPaintTools
import android.graphics.Paint.Align; //导入依赖的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);
}
示例9: init
import android.graphics.Paint.Align; //导入依赖的package包/类
private void init(Context context) {
setLayerType(1, null);
this.mContext = context;
this.lineHeight = DensityUtil.dip2px(context, (float) this.lineHeight);
this.textSize = DensityUtil.dip2px(context, (float) this.textSize);
this.textPaint = new Paint();
this.textPaint.setAntiAlias(true);
this.textPaint.setTextSize((float) this.textSize);
this.textPaint.setTextAlign(Align.LEFT);
this.textPaint.setColor(AbstractWheelTextAdapter.DEFAULT_TEXT_COLOR);
this.dividerPaint = new Paint();
this.dividerPaint.setAntiAlias(true);
this.dividerPaint.setTextSize((float) this.textSize);
this.dividerPaint.setTextAlign(Align.LEFT);
this.dividerPaint.setColor(-1);
this.dividerPaint.setStrokeWidth(2.0f);
this.backgroundPaint = new Paint();
this.backgroundPaint.setAntiAlias(true);
this.backgroundPaint.setStyle(Style.FILL_AND_STROKE);
this.backgroundPaint.setStrokeCap(Cap.ROUND);
}
示例10: initAxisTextAlignment
import android.graphics.Paint.Align; //导入依赖的package包/类
private void initAxisTextAlignment(Axis axis, int position) {
this.namePaintTab[position].setTextAlign(Align.CENTER);
if (position == 0 || 3 == position) {
this.labelPaintTab[position].setTextAlign(Align.CENTER);
} else if (1 == position) {
if (axis.isInside()) {
this.labelPaintTab[position].setTextAlign(Align.LEFT);
} else {
this.labelPaintTab[position].setTextAlign(Align.RIGHT);
}
} else if (2 != position) {
} else {
if (axis.isInside()) {
this.labelPaintTab[position].setTextAlign(Align.RIGHT);
} else {
this.labelPaintTab[position].setTextAlign(Align.LEFT);
}
}
}
示例11: initPaintTools
import android.graphics.Paint.Align; //导入依赖的package包/类
private void initPaintTools(){
mSatValPaint = new Paint();
mSatValTrackerPaint = new Paint();
mHueAlphaTrackerPaint = new Paint();
mAlphaPaint = new Paint();
mAlphaTextPaint = new Paint();
mBorderPaint = new Paint();
mSatValTrackerPaint.setStyle(Style.STROKE);
mSatValTrackerPaint.setStrokeWidth(DrawingUtils.dpToPx(getContext(), 2));
mSatValTrackerPaint.setAntiAlias(true);
mHueAlphaTrackerPaint.setColor(mSliderTrackerColor);
mHueAlphaTrackerPaint.setStyle(Style.STROKE);
mHueAlphaTrackerPaint.setStrokeWidth(DrawingUtils.dpToPx(getContext(), 2));
mHueAlphaTrackerPaint.setAntiAlias(true);
mAlphaTextPaint.setColor(0xff1c1c1c);
mAlphaTextPaint.setTextSize(DrawingUtils.dpToPx(getContext(), 14));
mAlphaTextPaint.setAntiAlias(true);
mAlphaTextPaint.setTextAlign(Align.CENTER);
mAlphaTextPaint.setFakeBoldText(true);
}
示例12: drawTicks
import android.graphics.Paint.Align; //导入依赖的package包/类
/**
* Draws the chart tick lines.
*
* @param canvas the canvas
* @param min the minimum chart value
* @param max the maximum chart value
* @param minAngle the minimum chart angle value
* @param maxAngle the maximum chart angle value
* @param centerX the center x value
* @param centerY the center y value
* @param longRadius the long radius
* @param shortRadius the short radius
* @param ticks the tick spacing
* @param paint the paint settings
* @param labels paint the labels
* @return the angle
*/
private void drawTicks(Canvas canvas, double min, double max, double minAngle, double maxAngle,
int centerX, int centerY, double longRadius, double shortRadius, double ticks, Paint paint,
boolean labels) {
for (double i = min; i <= max; i += ticks) {
double angle = getAngleForValue(i, minAngle, maxAngle, min, max);
double sinValue = Math.sin(angle);
double cosValue = Math.cos(angle);
int x1 = Math.round(centerX + (float) (shortRadius * sinValue));
int y1 = Math.round(centerY + (float) (shortRadius * cosValue));
int x2 = Math.round(centerX + (float) (longRadius * sinValue));
int y2 = Math.round(centerY + (float) (longRadius * cosValue));
canvas.drawLine(x1, y1, x2, y2, paint);
if (labels) {
paint.setTextAlign(Align.LEFT);
if (x1 <= x2) {
paint.setTextAlign(Align.RIGHT);
}
String text = i + "";
if (Math.round(i) == (long) i) {
text = (long) i + "";
}
canvas.drawText(text, x1, y1, paint);
}
}
}
示例13: initAxesRange
import android.graphics.Paint.Align; //导入依赖的package包/类
public void initAxesRange(int scales) {
mYTitle = new String[scales];
yLabelsAlign = new Align[scales];
yAxisAlign = new Align[scales];
mYLabelsColor = new int[scales];
mMinX = new double[scales];
mMaxX = new double[scales];
mMinY = new double[scales];
mMaxY = new double[scales];
mGridColors = new int[scales];
for (int i = 0; i < scales; i++) {
mYLabelsColor[i] = TEXT_COLOR;
mGridColors[i] = Color.argb(75, 200, 200, 200);
initAxesRangeForScale(i);
}
}
示例14: BatteryLevelView
import android.graphics.Paint.Align; //导入依赖的package包/类
public BatteryLevelView(Context context)
{
super(context);
// canvas paint
paintCanvas = new Paint();
paintCanvas.setStyle(Paint.Style.FILL);
paintCanvas.setColor(Color.BLACK);
paintCanvas.setAlpha(128);
// text paint
paintTextLevel = new Paint();
paintTextLevel.setAntiAlias(true);
paintTextLevel.setFakeBoldText(true);
paintTextLevel.setTextSize(150);
paintTextLevel.setTextAlign(Align.CENTER);
paintTextLevel.setShadowLayer(5, 0, 0, Color.BLACK);
paintTextLevel.setColor(Color.WHITE);
}
示例15: AbstractChartRenderer
import android.graphics.Paint.Align; //导入依赖的package包/类
public AbstractChartRenderer(Context context, Chart chart) {
this.density = context.getResources().getDisplayMetrics().density;
this.scaledDensity = context.getResources().getDisplayMetrics().scaledDensity;
this.chart = chart;
this.computator = chart.getChartComputator();
labelMargin = ChartUtils.dp2px(density, DEFAULT_LABEL_MARGIN_DP);
labelOffset = labelMargin;
labelPaint.setAntiAlias(true);
labelPaint.setStyle(Paint.Style.FILL);
labelPaint.setTextAlign(Align.LEFT);
labelPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
labelPaint.setColor(Color.WHITE);
labelBackgroundPaint.setAntiAlias(true);
labelBackgroundPaint.setStyle(Paint.Style.FILL);
}