當前位置: 首頁>>代碼示例>>Java>>正文


Java Shape.draw方法代碼示例

本文整理匯總了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);
}
 
開發者ID:gabuzomeu,項目名稱:geoPingProject,代碼行數:22,代碼來源:PersonColorDrawableHelper.java

示例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);
    }
}
 
開發者ID:hh-in-zhuzhou,項目名稱:ShangHanLun,代碼行數:40,代碼來源:ATableViewCellDrawable.java

示例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);   
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:6,代碼來源:DefaultSectionAdapter.java

示例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);
}
 
開發者ID:Mobideck,項目名稱:appdeck-android,代碼行數:6,代碼來源:PopOverFragment.java

示例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);
}
 
開發者ID:denisk20,項目名稱:bullshit-bingo-champion,代碼行數:6,代碼來源:CustomShapeDrawable.java


注:本文中的android.graphics.drawable.shapes.Shape.draw方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。