我尝试了下面的 xml 代码,但没有得到图像中的输出。
<item >
<shape>
<gradient
android:startColor= "#AE845c"
android:endColor="#935Fc0"
/>
</shape>
</item>
我想要这样的。
最佳答案
尝试加角度
<item >
<shape>
<gradient
android:angle="90"
android:startColor= "#bc9b78"
android:endColor="#7c4727"
/>
</shape>
</item>
如果它不起作用,请将代码放在您正在使用它的地方。
关于android - 按钮中的渐变效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13985448/