Android - 自定义标题栏渐变问题
我想创建一个自定义渐变和将其应用到 LinearLayout 的背景。
以下是渐变代码:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#31527B"
android:endColor="#20426F"
android:angle="270"/>
</shape>
我需要如下所示的渐变:
不知怎的,我没有得到这种效果。我在角度等方面做错了什么/我需要对渐变应用更多属性吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将角度设置为 90,这里有一个示例 http://www.android10.org/index.php/forums/43-view-layout-a-resource/328-gradient-backgrounds
这里另一个: Android LinearLayout 渐变背景
希望这有帮助...
Try putting angle to 90, here you have an example http://www.android10.org/index.php/forums/43-view-layout-a-resource/328-gradient-backgrounds
And here another: Android LinearLayout Gradient Background
Hope this helps...