如何像这样在 Android 中创建径向渐变
How Create radial Gradiant In Android like this
我想创建这样的渐变但是 :
左梯度是我的目标梯度右梯度是我的梯度
这是我的梯度代码 xml :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:centerColor="#ffffff"
android:endColor="#4f4f4f"
android:gradientRadius="700"
android:startColor="#ffffff"
android:type="radial" >
</gradient>
请帮忙创建一个像左图这样的渐变thx
已编辑:
在真实设备中我的渐变显示白色。
编辑2:
这些 Gradiant My Friend Post 好的,但是目标渐变中的颜色在真实设备中不显示
没有替代方法?
这样做:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:centerColor="#E7E6E6"
android:endColor="#DADADA"
android:gradientRadius="800"
android:startColor="#EEEDED"
android:type="radial" >
</gradient>
</shape>
截图:
这是一个使用它的工具,您可以设计任何可绘制对象Tool
试试这个
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:type="linear"
android:startColor="#FF2d7706"
android:endColor="#FF98d434"
android:angle="90"/>
</shape>
我想创建这样的渐变但是 :
左梯度是我的目标梯度右梯度是我的梯度 这是我的梯度代码 xml :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:centerColor="#ffffff"
android:endColor="#4f4f4f"
android:gradientRadius="700"
android:startColor="#ffffff"
android:type="radial" >
</gradient>
请帮忙创建一个像左图这样的渐变thx
已编辑: 在真实设备中我的渐变显示白色。 编辑2: 这些 Gradiant My Friend Post 好的,但是目标渐变中的颜色在真实设备中不显示 没有替代方法?
这样做:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:centerColor="#E7E6E6"
android:endColor="#DADADA"
android:gradientRadius="800"
android:startColor="#EEEDED"
android:type="radial" >
</gradient>
</shape>
截图:
这是一个使用它的工具,您可以设计任何可绘制对象Tool
试试这个
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:type="linear"
android:startColor="#FF2d7706"
android:endColor="#FF98d434"
android:angle="90"/>
</shape>