Java 类android.graphics.drawable.shapes.ArcShape 实例源码

项目:RLibrary    文件:ResUtil.java   
public static Drawable generateCircleBgDrawable(float width, int color) {
    Shape arcShape = new ArcShape(0, 360);
    ShapeDrawable shopDrawablePress = new ShapeDrawable(arcShape);//圆形shape
    shopDrawablePress.getPaint().setColor(color);//设置颜色
    shopDrawablePress.getPaint().setStyle(Paint.Style.STROKE);//设置颜色
    shopDrawablePress.getPaint().setStrokeWidth(width);//设置颜色
    return shopDrawablePress;
}
项目:color-picker    文件:PaletteGridAdapter.java   
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
    View view = convertView;
    if (view == null)
    {
        /*
         * TODO: build the layout programmatically
*/
        view = mLayoutInflater.inflate(R.layout.org_dmfs_colorpickerdialog_palette_field, null);
    }

    // set the background to a colored circle
    // TODO: allow to customize the shape
    Shape shape = new ArcShape(0, 360);
    ShapeDrawable bg = new ShapeDrawable(shape);
    bg.getPaint().setColor(mPalette.colorAt(position));

    if (android.os.Build.VERSION.SDK_INT < 16)
    {
        view.setBackgroundDrawable(bg);
    }
    else
    {
        view.setBackground(bg);
    }

    return view;

}