如何围绕圆圈绘制渐变笔划? 我试过像
// inside init called only once
mGlowMenuPaint.setStyle(Style.STROKE);
mGlowMenuPaint.setColor(Color.TRANSPARENT);
mGlowMenuPaint.setStrokeWidth(15);
Shader s = new SweepGradient(0, 0, Color.BLACK, Color.WHITE);
mGlowMenuPaint.setShader(s);
// inside onDraw method
canvas.drawArc(mMenuRect, mStartAngle, 360, true, mGlowMenuPaint);
但它不是渐变。有谁知道什么是问题?
答案 0 :(得分:0)
您可以尝试这样的事情:
<<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:innerRadius="80dp"
android:shape="ring"
android:thickness="20dp"
android:useLevel="false">
<size
android:width="200dp"
android:height="200dp" />
<gradient
android:endColor="#00ff0000"
android:gradientRadius="200"
android:startColor="#ffff0000"
android:type="radial" />
</shape>
</item>
<item
android:bottom="20dp"
android:left="20dp"
android:right="20dp"
android:top="20dp">
<shape android:shape="oval">
<stroke
android:width="1dp"
android:color="#ff0000" />
</shape>
</item>
</layer-list>