1

我有以下可绘制对象:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient 
        android:startColor="#2F2F2F" 
        android:endColor="#5A5A5A"
        android:angle="90"
        android:dither="true"
     />
</shape>

无论如何以 50% 的 startColor 或 50% 的 endColor 开始?

是否有任何链接可以显示我可以应用于渐变的所有属性?

4

2 回答 2

1

这些页面显示了您可以应用于渐变的所有属性。

http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape

http://developer.android.com/reference/android/graphics/drawable/GradientDrawable.html

要按照您的要求在中间做一些事情,请尝试使用该android:centerColor属性。

于 2010-09-24T00:14:09.367 回答
0

你说的是透明度吗?我相当确定您可以只使用 8 位颜色代码而不是 6 位,其中前 2 位构成 alpha 值。所以#AARRGGBB,或者类似#882F2F2F的东西。

于 2010-09-24T01:21:56.570 回答