@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);
}
}
ATableViewCellDrawable.java 文件源码
java
阅读 38
收藏 0
点赞 0
评论 0
项目:ShangHanLun
作者:
评论列表
文章目录