首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

画一个倒三角形

2013-03-06 
画一个倒三角public class ArrowView extends View{private Context mContext null@Overrideprotected

画一个倒三角

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;}}

?

热点排行