【问题标题】:Android background gradient radialAndroid背景渐变径向
【发布时间】:2015-11-04 21:49:17
【问题描述】:

我希望我的应用程序有一个背景渐变径向,我想我做到了,但在运行时我的应用程序只显示一种颜色。

这是我的可绘制背景

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<gradient
    android:type="radial"
    android:gradientRadius="360"
    android:startColor="@color/color_start"
    android:endColor="@color/color_end" />

我在我的活动 XML 中这样称呼它:

android:background="@drawable/background_app"

PD:对不起我的英语不好

【问题讨论】:

  • 您在color_startcolor_end 中存储的值是什么,因为这段代码适合我。
  • #001e2e#fff 我的应用只显示白色@BartoszLipinski

标签: android xml drawable gradient radial


【解决方案1】:

android:gradientRadius="250" 将被忽略。您应该指向具有 px 或 dp 值的维度资源,例如:android:gradientRadius="@dimen/gradient_radius"

【讨论】:

  • 1+ 对你真的有帮助