我需要创建一个自定义的按钮图形具有边框,渐变背景和玻璃效果:自定义按钮:玻璃效果
我不想使用 9patch或代码自定义类,只是xml(形状,图层,...)。
在这里,我用它来绘制按钮的XML代码(它不不包括 “玻璃效果” 呢!):
<layer-list>
</shape>
<!-- item to draw the inner border and the background -->
<item>
<shape>
<stroke
android:width="4px"
android:color="#5f87aa" />
<corners android:radius="10dp" />
<gradient
android:angle="270"
android:endColor="#034b89"
android:startColor="#03437b" />
</shape>
</item>
<!-- item to draw the outer border (transparent background) -->
<item>
<shape>
<stroke
android:width="2px"
android:color="#212121" />
<corners android:radius="10dp" />
<solid android:color="#00000000" />
</item>
</layer-list>
它看起来像这样:
那么我能做些什么来让玻璃效果呢?
感谢您的回复。是的,我尝试使用centerColor属性,但结果不满足我... –