本文整理汇总了Java中android.graphics.Paint.Style类的典型用法代码示例。如果您正苦于以下问题:Java Style类的具体用法?Java Style怎么用?Java Style使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Style类属于android.graphics.Paint包,在下文中一共展示了Style类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RoundProgressBarWidthNumber
import android.graphics.Paint.Style; //导入依赖的package包/类
public RoundProgressBarWidthNumber(Context context, AttributeSet attrs) {
super(context, attrs);
mReachedProgressBarHeight = (int) (mUnReachedProgressBarHeight * 2.5f);
TypedArray ta = context.obtainStyledAttributes(attrs,
R.styleable.RoundProgressBarWidthNumber);
mRadius = (int) ta.getDimension(
R.styleable.RoundProgressBarWidthNumber_radius, mRadius);
ta.recycle();
mPaint.setStyle(Style.STROKE);
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setStrokeCap(Cap.ROUND);
}
示例2: DataRenderer
import android.graphics.Paint.Style; //导入依赖的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));
}
示例3: onDraw
import android.graphics.Paint.Style; //导入依赖的package包/类
/**
* 重写绘制指示器view
* @param canvas
*/
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
float width = (getWidth() - ((radius * 2 * count) + (space * (count - 1)))) / 2.f;
Log.d(TAG_FLOWINDICATOR,"当前选中的为:"+this.seleted);
for (int i = 0; i < count; i++) {
if (i == seleted) {
paint.setStyle(Style.FILL);
canvas.drawBitmap(bmp_selected, 130+width + getPaddingLeft()
+ radius + i * (space + radius + radius), 0, null);
} else {
paint.setStyle(Style.FILL);
canvas.drawBitmap(bmp_normal, 130+width + getPaddingLeft() + radius
+ i * (space + radius + radius), 0, null);
}
}
}
示例4: init
import android.graphics.Paint.Style; //导入依赖的package包/类
private void init(AttributeSet attrs) {
if (attrs != null) {
TypedArray array = getContext().obtainStyledAttributes(attrs, R.styleable
.HorizontalProgressView);
this.totalNumber = array.getInt(0, 4);
this.currentNumber = array.getInt(1, 0);
this.completedColor = array.getColor(2, this.completedColor);
this.uncompletedColor = array.getColor(3, this.uncompletedColor);
this.gapWidth = (int) array.getDimension(4, (float) dip(this.gapWidth));
this.itemWidth = (int) array.getDimension(5, 0.0f);
array.recycle();
} else {
this.gapWidth = dip(this.gapWidth);
}
this.paint.setAntiAlias(true);
this.paint.setStyle(Style.FILL);
}
示例5: LineChartRenderer
import android.graphics.Paint.Style; //导入依赖的package包/类
public LineChartRenderer(Context context, Chart chart, LineChartDataProvider dataProvider) {
super(context, chart);
this.dataProvider = dataProvider;
this.touchToleranceMargin = ChartUtils.dp2px(this.density, 4);
this.linePaint.setAntiAlias(true);
this.linePaint.setStyle(Style.STROKE);
this.linePaint.setStrokeCap(Cap.ROUND);
this.linePaint.setStrokeWidth((float) ChartUtils.dp2px(this.density, 3));
this.pointPaint.setAntiAlias(true);
this.pointPaint.setStyle(Style.FILL);
this.weightStrPaint.setAntiAlias(true);
this.weightStrPaint.setColor(-1);
this.weightStrPaint.setTextSize((float) ChartUtils.dp2px(this.density, 12));
this.weightLinePaint.setAntiAlias(true);
this.weightLinePaint.setStyle(Style.STROKE);
this.weightLinePaint.setStrokeWidth((float) ChartUtils.dp2px(this.density, 1));
this.weightLinePaint.setColor(ChartUtils.DEFAULT_TARGET_COLOR);
this.checkPrecision = ChartUtils.dp2px(this.density, 2);
}
示例6: draw
import android.graphics.Paint.Style; //导入依赖的package包/类
public void draw(Canvas g2, float x, float y) {
float th = thickness / 2;
box.draw(g2, x + space + thickness, y);
Paint st = AjLatexMath.getPaint();
float w = st.getStrokeWidth();
int c = st.getColor();
Style s = st.getStyle();
st.setStrokeWidth(thickness);
st.setStyle(Style.STROKE);
float penth = 0;// (float) Math.abs(1 / g2.getTransform().getScaleX());
g2.drawRect(x + th, y - height + th, x + th + width - shadowRule
- thickness, y + th + depth - shadowRule - thickness, st);
st.setStyle(Style.FILL);
g2.drawRect(x + shadowRule - penth, y + depth - shadowRule - penth, x
- penth + width, y + depth - penth, st);
g2.drawRect(x + width - shadowRule - penth, y - height + th
+ shadowRule, x + width - penth, y + shadowRule + depth - 2
* shadowRule, st);
st.setColor(c);
st.setStrokeWidth(w);
st.setStyle(s);
st.clearShadowLayer();
}
示例7: init
import android.graphics.Paint.Style; //导入依赖的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);
}
示例8: createBufferedImage
import android.graphics.Paint.Style; //导入依赖的package包/类
/**
* @param formula
* the formula
* @param style
* the style
* @param size
* the size
* @param transparency
* , if true the background is transparent
* @return the generated image
*/
public Bitmap createBufferedImage(int style, float size, Integer fg,
Integer bg) throws ParseException {
TeXIcon icon = createTeXIcon(style, size);
icon.setInsets(new Insets(2, 2, 2, 2));
int w = icon.getIconWidth(), h = icon.getIconHeight();
Bitmap image = Bitmap.createBitmap(w, h, Config.ARGB_8888);
Canvas g2 = new Canvas(image);
if (bg != null) {
Paint st = new Paint();
st.setStyle(Style.FILL_AND_STROKE);
st.setColor(bg);
g2.drawRect(0, 0, w, h, st);
}
icon.setForeground(fg == null ? Color.BLACK : fg);
icon.paintIcon(g2, 0, 0);
return image;
}
示例9: initPaints
import android.graphics.Paint.Style; //导入依赖的package包/类
/**
* initialize paints
*/
private void initPaints(){
defaultPaint = new Paint();
defaultPaint.setColor(getResources().getColor(R.color.blue_78d2f6));
defaultPaint.setStrokeWidth(2.0f);
defaultPaint.setStyle(Style.STROKE);
defaultPaint.setAntiAlias(true);
selectPaint = new Paint();
selectPaint.setColor(getResources().getColor(R.color.blue_00aaee));
selectPaint.setStrokeWidth(3.0f);
//selectPaint.setStyle(Style.STROKE);
selectPaint.setAntiAlias(true);
errorPaint = new Paint();
errorPaint.setColor(getResources().getColor(R.color.red_f3323b));
errorPaint.setStrokeWidth(3.0f);
//errorPaint.setStyle(Style.STROKE);
errorPaint.setAntiAlias(true);
}
示例10: AxesRenderer
import android.graphics.Paint.Style; //导入依赖的package包/类
public AxesRenderer(Context context, Chart chart) {
this.chart = chart;
this.resources = context.getResources();
this.mContext = context;
this.computator = chart.getChartComputator();
this.density = context.getResources().getDisplayMetrics().density;
this.scaledDensity = context.getResources().getDisplayMetrics().scaledDensity;
this.axisMargin = ChartUtils.dp2px(this.density, 2);
for (int position = 0; position < 4; position++) {
this.labelPaintTab[position].setStyle(Style.FILL);
this.labelPaintTab[position].setAntiAlias(true);
this.namePaintTab[position].setStyle(Style.FILL);
this.namePaintTab[position].setAntiAlias(true);
this.linePaintTab[position].setStyle(Style.STROKE);
this.linePaintTab[position].setAntiAlias(true);
}
}
示例11: drawBackground
import android.graphics.Paint.Style; //导入依赖的package包/类
/**
* Draws the chart background.
*/
public void drawBackground(Canvas canvas, double x, double y, double width, double height,
Paint paint, com.cyzapps.VisualMFP.Color newColor) {
int nPaintOriginalColor = paint.getColor();
Style stylePaintOriginalStyle = paint.getStyle();
if (newColor != null) { // a valid color
paint.setColor(newColor.getARGB());
} else if (mcolorBkGrnd != null) {
paint.setColor(mcolorBkGrnd.getARGB());
}
paint.setStyle(Style.FILL);
float fLeft = (float)x, fTop = (float)y, fRight = (float)(x + width), fBottom = (float)(y + height);
canvas.drawRect(fLeft, fTop, fRight, fBottom, paint);
// restore paint attribute.
paint.setStyle(stylePaintOriginalStyle);
paint.setColor(nPaintOriginalColor);
}
示例12: ScrollSlidingTabStrip
import android.graphics.Paint.Style; //导入依赖的package包/类
public ScrollSlidingTabStrip(Context context) {
super(context);
setFillViewport(true);
setWillNotDraw(false);
setHorizontalScrollBarEnabled(false);
tabsContainer = new LinearLayout(context);
tabsContainer.setOrientation(LinearLayout.HORIZONTAL);
tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
addView(tabsContainer);
rectPaint = new Paint();
rectPaint.setAntiAlias(true);
rectPaint.setStyle(Style.FILL);
defaultTabLayoutParams = new LinearLayout.LayoutParams(AndroidUtilities.dp(52), LayoutHelper.MATCH_PARENT);
}
示例13: PieItem
import android.graphics.Paint.Style; //导入依赖的package包/类
public PieItem(Context context, Context gbContext, PieLayout parent, int flags, int width,
Object tag, View view, PieController.ColorInfo colorInfo) {
mContext = context;
mGbResources = gbContext.getResources();
mView = view;
mPieLayout = parent;
this.tag = tag;
this.width = width;
this.flags = flags | PieDrawable.VISIBLE | PieDrawable.DISPLAY_ALL;
mBackgroundPaint.setAntiAlias(true);
mSelectedPaint.setAntiAlias(true);
mOutlinePaint.setAntiAlias(true);
mOutlinePaint.setStyle(Style.STROKE);
mOutlinePaint.setStrokeWidth(mGbResources.getDimensionPixelSize(R.dimen.pie_outline));
setColor(colorInfo);
}
示例14: ColumnChartRenderer
import android.graphics.Paint.Style; //导入依赖的package包/类
public ColumnChartRenderer(Context context, Chart chart, ColumnChartDataProvider dataProvider) {
super(context, chart);
this.dataProvider = dataProvider;
this.subcolumnSpacing = ChartUtils.dp2px(this.density, 1);
this.touchAdditionalWidth = ChartUtils.dp2px(this.density, 4);
this.columnPaint.setAntiAlias(true);
this.columnPaint.setStyle(Style.FILL);
this.columnPaint.setStrokeCap(Cap.SQUARE);
this.caloryLinePaint.setAntiAlias(true);
this.caloryLinePaint.setStyle(Style.STROKE);
this.caloryLinePaint.setStrokeWidth((float) ChartUtils.dp2px(this.density, 1));
this.caloryLinePaint.setColor(ChartUtils.DEFAULT_TARGET_COLOR);
this.caloryTextPaint.setAntiAlias(true);
this.caloryTextPaint.setStyle(Style.FILL);
this.caloryTextPaint.setTextSize((float) ChartUtils.dp2px(this.density, 12));
this.caloryTextPaint.setColor(ChartUtils.COLOR_BACKGROUND);
}
示例15: PagerSlidingTabStrip
import android.graphics.Paint.Style; //导入依赖的package包/类
public PagerSlidingTabStrip(Context context) {
super(context);
setFillViewport(true);
setWillNotDraw(false);
tabsContainer = new LinearLayout(context);
tabsContainer.setOrientation(LinearLayout.HORIZONTAL);
tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
addView(tabsContainer);
rectPaint = new Paint();
rectPaint.setAntiAlias(true);
rectPaint.setStyle(Style.FILL);
defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutHelper.MATCH_PARENT);
}