android shapedrawable的颜色如何设置
导读:可以通过在ShapeDrawable对象中设置SolidColor属性来设置ShapeDrawable的颜色。 ShapeDrawable shapeDrawable = new ShapeDrawable(new OvalShape( ...
可以通过在ShapeDrawable对象中设置SolidColor属性来设置ShapeDrawable的颜色。
ShapeDrawable shapeDrawable = new ShapeDrawable(new OvalShape());
shapeDrawable.getPaint().setColor(Color.RED);
在这个例子中,我们创建了一个椭圆形状的ShapeDrawable对象,并通过getPaint().setColor()方法将其颜色设置为红色。您可以使用任何颜色常量来设置ShapeDrawable的颜色。
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: android shapedrawable的颜色如何设置
本文地址: https://pptw.com/jishu/693171.html