下面列出了怎么用android.graphics.drawable.shapes.ArcShape的API类实例代码及写法,或者点击链接到github查看源代码。
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
View view = convertView;
if (view == null)
{
view = mLayoutInflater.inflate(R.layout.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;
}