android - 按钮中的渐变效果

标签 android android-layout

我尝试了下面的 xml 代码,但没有得到图像中的输出。

<item  >
    <shape>
        <gradient
           android:startColor= "#AE845c"
           android:endColor="#935Fc0"

             />


    </shape>
</item>

我想要这样的。

enter image description here

最佳答案

尝试加角度

<item  >
    <shape>
        <gradient
           android:angle="90"
           android:startColor= "#bc9b78"
           android:endColor="#7c4727"

             />


    </shape>
</item>

如果它不起作用,请将代码放在您正在使用它的地方。

关于android - 按钮中的渐变效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13985448/

相关文章:

android - 使用 match_parent 在 ListView 中覆盖 RelativeLayout

Android:在翻译中缩放 EditText Android 问题并在放置在 parentView 外部时获取 childView 的 Touch 事件

android - 从用户的时间线获取推文

java - 检查 RemoteView 开关的 boolean 值的方法?

android - 如何在 adb shell 中获得 root 访问权限以解锁模式

java - 在 android 中添加新的单选按钮集之前清除单选按钮

android - 如何更改应用程序中使用的默认键盘的背景颜色?

android - ListView.setFooterView(v) 页脚更改在 VIewPager 显示的 ListView 中不可见

android - 出现通知的 Espresso 测试

android - 如何在安卓模拟器上安装应用程序?