本文整理汇总了Java中android.graphics.drawable.shapes.Shape.draw方法的典型用法代码示例。如果您正苦于以下问题:Java Shape.draw方法的具体用法?Java Shape.draw怎么用?Java Shape.draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.shapes.Shape
的用法示例。
在下文中一共展示了Shape.draw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDraw
import android.graphics.drawable.shapes.Shape; //导入方法依赖的package包/类
protected void onDraw(Shape shape, Canvas canvas, Paint paint) {
// V1
shape.draw(canvas, fillpaint);
shape.draw(canvas, strokepaint);
// V2
// shape.resize(canvas.getClipBounds().right,
// canvas.getClipBounds().bottom);
// shape.draw(canvas, fillpaint);
//
// Matrix matrix = new Matrix();
// matrix.setRectToRect(new RectF(0, 0,
// canvas.getClipBounds().right, canvas.getClipBounds().bottom), new
// RectF(strokeWidth / 2, strokeWidth / 2,
// canvas.getClipBounds().right - strokeWidth
// / 2, canvas.getClipBounds().bottom - strokeWidth / 2),
// Matrix.ScaleToFit.FILL);
// canvas.concat(matrix);
//
// shape.draw(canvas, strokepaint);
}
示例2: onDraw
import android.graphics.drawable.shapes.Shape; //导入方法依赖的package包/类
@Override
protected void onDraw(Shape shape, Canvas canvas, Paint paint) {
canvas.save();
Rect bounds = canvas.getClipBounds();
// bottom etched line.
if (mBottomEtchedPaint != null) shape.draw(canvas, mBottomEtchedPaint);
canvas.restore();
canvas.save();
// separator.
canvas.concat(getSeparatorPaintMatrix(bounds));
shape.draw(canvas, mSeparatorPaint);
canvas.restore();
canvas.save();
// top etched line.
canvas.concat(getTopEtchedPaintMatrix(bounds));
if (mTopEtchedPaint != null) shape.draw(canvas, mTopEtchedPaint);
canvas.restore();
canvas.save();
// background.
canvas.concat(getBackgroundPaintMatrix(bounds));
shape.draw(canvas, mBackgroundPaint);
canvas.restore();
canvas.save();
// selected.
canvas.concat(getSelectedPaintMatrix(bounds));
if (mSelectedPaint != null) {
// we'll set the selected color on onDraw event since we don't know drawable height up to here.
Shader shader = new LinearGradient(0, 0, 0, mRowHeight, mStartColor, mEndColor, Shader.TileMode.MIRROR);
mSelectedPaint.setShader(shader);
shape.draw(canvas, mSelectedPaint);
}
}
示例3: onDraw
import android.graphics.drawable.shapes.Shape; //导入方法依赖的package包/类
@Override
protected void onDraw(Shape shape, Canvas canvas, Paint paint) {
shape.draw(canvas, fillpaint);
canvas.drawLine(0, shape.getHeight(), shape.getWidth(), shape.getHeight(), strokepaint);
}
示例4: onDraw
import android.graphics.drawable.shapes.Shape; //导入方法依赖的package包/类
@Override
protected void onDraw(Shape shape, Canvas canvas, Paint paint) {
shape.draw(canvas, fillpaint);
shape.draw(canvas, strokepaint);
}
示例5: onDraw
import android.graphics.drawable.shapes.Shape; //导入方法依赖的package包/类
@Override
protected void onDraw(Shape shape, Canvas canvas, Paint fillpaint) {
shape.draw(canvas, fillpaint);
shape.draw(canvas, strokepaint);
}