我正在尝试通过编程复制以下渐变效果。
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="@color/startcolor"
android:centerColor="#343434"
android:endColor="#00000000"
android:type="radial"
android:gradientRadius="140"
android:centerY="45%"
/>
<corners android:radius="0dp" />
</shape>
如何以编程方式设置参数?谢谢
android:centerY="45%"
setGradientCenter
。 - Felipe Conde