本文整理匯總了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);
}