我需要一个带有角度渐变的按钮,即光从左下角向上填充。
我尝试了以下方法:
<gradient
android:angle="90"
android:startColor="#E60000"
android:centerColor="#800000"
android:endColor="#E60000"
android:type="sweep" />
然而,它只是从右到左填充光线。有人能帮我解决吗?
尝试使用角度值为135或225
android:angle="135"
或 android:angle="225"
只需以编程方式完成它:
yourView.background = GradientDrawable(
Orientation.BL_TR,
intArrayOf(Color.RED, Color.GREEN),
)