我正在尝试学习如何在 Android 画布上绘图。这段代码似乎有效并且可以编译,但我没有得到我的形状。
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ShapeDrawable shape = new ShapeDrawable(new ArcShape(0, 250));
shape.setIntrinsicHeight(100);
shape.setIntrinsicWidth(100);
shape.getPaint().setColor(Color.RED);
Canvas canvas = new Canvas();
shape.draw(canvas);
}
}
我正在尝试按照这里的教程:http: //kirill-poletaev.blogspot.com/2013/02/android-beginner-tutorial-part-90-path.html