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


Java Paint.setStyle方法代码示例

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


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

示例1: ColorView

import android.graphics.Paint; //导入方法依赖的package包/类
public ColorView(Context context, int resourceLabel, boolean square) {
	super(context);

	mSquare = square;
	mResourceLabel = resourceLabel;

	mNumberFormatter = NumberFormat.getIntegerInstance(getContext().getResources().getConfiguration().locale);

	DisplayMetrics metrics = context.getResources().getDisplayMetrics();

	mTextPaint = new Paint();
	mTextPaint.setAntiAlias(true);
	mTextPaint.setTextSize((int) (metrics.density * FONT_SIZE_DP + 0.5f));
	mTextPaint.setColor(0xFFFFFFFF);
	mTextPaint.setTextAlign(Paint.Align.CENTER);

	mShadowPaint = new Paint(mTextPaint);
	mShadowPaint.setStyle(Paint.Style.STROKE);
	mShadowPaint.setStrokeCap(Paint.Cap.ROUND);
	mShadowPaint.setStrokeJoin(Paint.Join.ROUND);
	mShadowPaint.setStrokeWidth(4f);
	mShadowPaint.setColor(0xFF000000);

	int marginPx = (int) (MARGIN_DP * metrics.density + 0.5f);
	setPadding(marginPx, marginPx, marginPx, marginPx);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:ColorsActivity.java

示例2: draw

import android.graphics.Paint; //导入方法依赖的package包/类
public void draw(Canvas g2, float x, float y) {
	drawDebug(g2, x, y);
	g2.save();
	g2.translate(x, y);
	Typeface font = FontInfo.getFont(cf.fontId);
	if (size != 1) {
		g2.scale(size, size);
	}
	Paint st = AjLatexMath.getPaint();
	st.setTextSize(TeXFormula.PIXELS_PER_POINT);
	st.setTypeface(font);
	st.setStyle(Style.FILL);
	st.setAntiAlias(true);
	st.setStrokeWidth(0);
	arr[0] = cf.c;
	g2.drawText(arr, 0, 1, 0, 0, st);
	g2.restore();
}
 
开发者ID:daquexian,项目名称:FlexibleRichTextView,代码行数:19,代码来源:CharBox.java

示例3: SwitchIconView

import android.graphics.Paint; //导入方法依赖的package包/类
public SwitchIconView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);

  TypedArray array = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.SwitchIconView, 0, 0);

  try {
    iconTintColor = array.getColor(R.styleable.SwitchIconView_si_tint_color, Color.BLACK);
    animationDuration = array.getInteger(R.styleable.SwitchIconView_si_animation_duration, DEFAULT_ANIMATION_DURATION);
    disabledStateAlpha = array.getFloat(R.styleable.SwitchIconView_si_disabled_alpha, DEFAULT_DISABLED_ALPHA);
    disabledStateColor = array.getColor(R.styleable.SwitchIconView_si_disabled_color, iconTintColor);
    enabled = array.getBoolean(R.styleable.SwitchIconView_si_enabled, true);
    noDash = array.getBoolean(R.styleable.SwitchIconView_si_no_dash, false);
  } finally {
    array.recycle();
  }

  if (disabledStateAlpha < 0f || disabledStateAlpha > 1f) {
    throw new IllegalArgumentException("Wrong value for si_disabled_alpha [" + disabledStateAlpha + "]. "
        + "Must be value from range [0, 1]");
  }

  colorFilter = new PorterDuffColorFilter(iconTintColor, PorterDuff.Mode.SRC_IN);
  setColorFilter(colorFilter);

  dashXStart = getPaddingLeft();
  dashYStart = getPaddingTop();

  dashPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
  dashPaint.setStyle(Paint.Style.STROKE);
  dashPaint.setColor(iconTintColor);

  clipPath = new Path();

  initDashCoordinates();
  setFraction(enabled ? 0f : 1f);
}
 
开发者ID:zagum,项目名称:Android-SwitchIcon,代码行数:37,代码来源:SwitchIconView.java

示例4: setUpPaint

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * Paintの初期化
 */
private void setUpPaint() {
    mPaint = new Paint();
    mPaint.setColor(mBackgroundColor);
    mPaint.setAntiAlias(true);
    mPaint.setStyle(Paint.Style.FILL);
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:10,代码来源:PlayPauseButton.java

示例5: createShadowBitmap

import android.graphics.Paint; //导入方法依赖的package包/类
private Bitmap createShadowBitmap(int shadowWidth, int shadowHeight, float shadowRadius, float shadowOffsetX, float shadowOffsetY, int fillColor) {
    Bitmap bitmap = Bitmap.createBitmap(shadowWidth, shadowHeight, Bitmap.Config.ALPHA_8);
    Canvas canvas = new Canvas(bitmap);
    RectF shadowRect = new RectF(shadowRadius, shadowRadius, shadowWidth - shadowRadius, shadowHeight - shadowRadius);
    if (shadowOffsetX > 0) {
        shadowRect.left += shadowOffsetX;
        shadowRect.right -= shadowOffsetX;
    } else if (shadowOffsetX < 0) {
        shadowRect.left += Math.abs(shadowOffsetX);
        shadowRect.right -= Math.abs(shadowOffsetX);
    }

    if (shadowOffsetY > 0) {
        shadowRect.top += shadowOffsetY;
        shadowRect.bottom -= shadowOffsetY;
    } else if (shadowOffsetY < 0) {
        shadowRect.top += Math.abs(shadowOffsetY);
        shadowRect.bottom -= Math.abs(shadowOffsetY);
    }

    Paint shadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    shadowPaint.setColor(Color.parseColor(DEFAULT_SHADOW_COLOR));
    shadowPaint.setStyle(Paint.Style.FILL);
    shadowPaint.setShadowLayer(shadowRadius, shadowOffsetX, shadowOffsetY, Color.parseColor(DEFAULT_SHADOW_COLOR));
    int radius = Math.max(mImageView.getMeasuredWidth(), mImageView.getMeasuredHeight());
    canvas.drawRoundRect(shadowRect, radius, radius, shadowPaint);

    return bitmap;
}
 
开发者ID:DingMouRen,项目名称:AnnularMenuView,代码行数:30,代码来源:ShadowImageView.java

示例6: init

import android.graphics.Paint; //导入方法依赖的package包/类
public void init(Context context, AttributeSet attrs){

        holder=getHolder();
        holder.addCallback(this);
        p=new Paint();
        p.setStrokeWidth(1);

        bgp=new Paint();
        bgp.setAntiAlias(true);
        bgp.setStyle(Paint.Style.STROKE);
        bgp.setStrokeWidth(1);

        scorep=new Paint();
        scorep.setColor(Color.parseColor("#996633"));
        scorep.setTextSize(50);
        scorep.setStrokeWidth(10);
        bmyp= BitmapFactory.decodeResource(getResources(), R.drawable.plane);
        bbullet= BitmapFactory.decodeResource(getResources(), R.drawable.bullet);
        botherp= BitmapFactory.decodeResource(getResources(), R.drawable.small);
        Bitmap tmp= BitmapFactory.decodeResource(getResources(), R.drawable.middle);
        otherpbit=new Bitmap[]{botherp,tmp};

        Bitmap tmp1=BitmapFactory.decodeResource(getResources(), R.drawable.bomb1);
        Bitmap tmp2=BitmapFactory.decodeResource(getResources(), R.drawable.bomb2);

        bomb=new Bitmap[]{tmp1,tmp2};
        fire=new int[]{2000,5000};
        SoundPool.Builder sb= new SoundPool.Builder();
        sb.setMaxStreams(2);
        sp=sb.build();
        shootID=sp.load(getContext(),R.raw.shoot,1);
        bombID=sp.load(getContext(),R.raw.explosion,1);
        overID=sp.load(getContext(),R.raw.over,1);
    }
 
开发者ID:dingdangmao123,项目名称:WxPlane,代码行数:35,代码来源:MySurface.java

示例7: drawLegendShape

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * The graphical representation of the legend shape.
 * 
 * @param canvas the canvas to paint to
 * @param renderer the series renderer
 * @param x the x value of the point the shape should be drawn at
 * @param y the y value of the point the shape should be drawn at
 * @param seriesIndex the series index
 * @param paint the paint to be used for drawing
 */
public void drawLegendShape(Canvas canvas, SimpleSeriesRenderer renderer, float x, float y,
    int seriesIndex, Paint paint) {
  if (((XYSeriesRenderer) renderer).isFillPoints()) {
    paint.setStyle(Style.FILL);
  } else {
    paint.setStyle(Style.STROKE);
  }
  switch (((XYSeriesRenderer) renderer).getPointStyle()) {
  case X:
    drawX(canvas, paint, x + SHAPE_WIDTH, y);
    break;
  case CIRCLE:
    drawCircle(canvas, paint, x + SHAPE_WIDTH, y);
    break;
  case TRIANGLE:
    drawTriangle(canvas, paint, new float[6], x + SHAPE_WIDTH, y);
    break;
  case SQUARE:
    drawSquare(canvas, paint, x + SHAPE_WIDTH, y);
    break;
  case DIAMOND:
    drawDiamond(canvas, paint, new float[8], x + SHAPE_WIDTH, y);
    break;
  case POINT:
    canvas.drawPoint(x + SHAPE_WIDTH, y, paint);
    break;
  }
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:39,代码来源:ScatterChart.java

示例8: draw

import android.graphics.Paint; //导入方法依赖的package包/类
@Override
public void draw(Canvas canvas, Paint paint) {
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(3);

    float circleSpacing=12;
    float x = (getWidth()) / 2;
    float y=(getHeight()) / 2;
    canvas.translate(x, y);
    canvas.scale(scaleFloat, scaleFloat);
    canvas.rotate(degrees);
    RectF rectF=new RectF(-x+circleSpacing,-y+circleSpacing,0+x-circleSpacing,0+y-circleSpacing);
    canvas.drawArc(rectF, -45, 270, false, paint);
}
 
开发者ID:magicbaby810,项目名称:SRecyclerView,代码行数:15,代码来源:BallClipRotateIndicator.java

示例9: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init(Context context) {
    mDensity = context.getResources().getDisplayMetrics().density;

    mStrokePaint = new Paint();
    mStrokePaint.setAntiAlias(true);
    mStrokePaint.setStyle(Paint.Style.STROKE);
    mStrokePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
    mStrokePaint.setStrokeWidth(STROKE_WIDTH * mDensity);
    mStrokePaint.setColor(Color.WHITE);

    mCheckDrawable = ResourcesCompat.getDrawable(context.getResources(),
            R.drawable.van_check_white_18dp, context.getTheme());
}
 
开发者ID:GitPhoenix,项目名称:VanGogh,代码行数:14,代码来源:CheckView.java

示例10: setup

import android.graphics.Paint; //导入方法依赖的package包/类
private void setup(Context context) {
    mPaint1 = new Paint();
    mPaint2 = new Paint();
    mPaint1.setStyle(Paint.Style.STROKE);
    mPaint1.setColor(Color.BLACK);
    mPaint1.setStrokeWidth(2);
    mPaint2.setStyle(Paint.Style.STROKE);
    mPaint2.setColor(Color.YELLOW);
}
 
开发者ID:googlecodelabs,项目名称:style-transfer,代码行数:10,代码来源:DrawView.java

示例11: init

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * 进行初始化的一些操作
 */
private void init(Context context) {

    //设置各点的位置
    mStartXPoint = 100;
    mStartYPoint = 100;
    mEndXPoint = 600;
    mEndYPoint = 600;
    mConXPoint = 400;
    mConYPoint = 0;
    mMoveXPoint = 100;
    mMoveYPoint = 100;

    //路径,画笔设置
    mPath = new Path();
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setColor(Color.BLUE);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(8);

    mCircleRadius = 20;
    mCirlcePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCirlcePaint.setColor(Color.BLUE);
    mCirlcePaint.setStyle(Paint.Style.FILL);

    setOnClickListener(this);


}
 
开发者ID:Lichenwei-Dev,项目名称:BezierView,代码行数:32,代码来源:BezierMoveView.java

示例12: OledDisplayHelper

import android.graphics.Paint; //导入方法依赖的package包/类
@Inject
public OledDisplayHelper(Application application,
                         SystemHelper systemHelper,
                         SensorDriverController sensorDriverController) {
    mSystemHelper = systemHelper;
    mSensorDriverController = sensorDriverController;
    mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTextPaint.setTextSize(TEXT_SIZE);
    mTextPaint.setTypeface(ResourcesCompat.getFont(application, R.font.oled_font));
    mTextPaint.setColor(Color.BLACK);
    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.WHITE);
    mBackgroundPaint.setStyle(Paint.Style.FILL);
    mNetworkInterfaceAddressList = new ArrayList<>(4);
}
 
开发者ID:leinardi,项目名称:androidthings-kuman-sm9,代码行数:16,代码来源:OledDisplayHelper.java

示例13: ShutterButton

import android.graphics.Paint; //导入方法依赖的package包/类
public ShutterButton(Context context) {
    super(context);
    shadowDrawable = getResources().getDrawable(R.drawable.camera_btn);
    whitePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    whitePaint.setStyle(Paint.Style.FILL);
    whitePaint.setColor(0xffffffff);
    redPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    redPaint.setStyle(Paint.Style.FILL);
    redPaint.setColor(0xffcd4747);
    state = State.DEFAULT;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:12,代码来源:ShutterButton.java

示例14: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {
    arcPaint = new Paint();
    arcPaint.setColor(arcColor);
    arcPaint.setStrokeWidth(borderWidth);
    arcPaint.setAntiAlias(true);
    arcPaint.setStyle(Paint.Style.STROKE);
    arcRect = new RectF();
}
 
开发者ID:AriesHoo,项目名称:UIWidget,代码行数:9,代码来源:MaterialProgressBar.java

示例15: initView

import android.graphics.Paint; //导入方法依赖的package包/类
private void initView() {
    mProgressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mProgressPaint.setColor(mProgressColor);
    mBackgroundPaint.setColor(mBackgroundColor);
    mProgressPaint.setStrokeWidth(10);
    mProgressPaint.setStyle(Paint.Style.FILL);
    mBackgroundPaint.setStrokeWidth(10);
    mBackgroundPaint.setStyle(Paint.Style.FILL);
}
 
开发者ID:TedaLIEz,项目名称:ParsingPlayer,代码行数:11,代码来源:VerticalProgressBar.java


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