读书人

画一个倒三角形

发布时间: 2013-03-06 16:20:31 作者: rapoo

画一个倒三角

public class ArrowView extends View{private Context mContext = null;@Overrideprotected void onDraw(Canvas canvas) {Path path = new Path();         path.moveTo(0, 0);         path.lineTo(getWidth(), 0);         path.lineTo(getWidth()/2, getHeight());         path.lineTo(0, 0);        ShapeDrawable circle = new ShapeDrawable(new PathShape(path, getWidth(), getHeight()));        circle.getPaint().setColor(mContext.getResources().getColor(R.color.download_bg_menu));        circle.setBounds(0, 0, getWidth(), getHeight());        circle.draw(canvas);super.onDraw(canvas);}public ArrowView(Context context, AttributeSet attrs) {super(context, attrs);mContext = context;}}

?

读书人网 >移动开发

热点推荐