如何在Android中创建径向渐变像这样

问题描述 投票:1回答:2

我想像这样创建一个渐变但是:

左渐变是我的目标渐变右渐变是我的渐变这是我的渐变代码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>

请帮助创建像左图片这样的渐变

编辑:在真正的设备我的渐变显示白色。编辑2:这些Gradiant我的朋友发布好但是目标渐变的颜色不在真实设备中显示没有替代方式?

android radial-gradients android-shape
2个回答
0
投票

做这个 :

   <?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>

截图:

enter image description here


0
投票

这是一个使用它的工具,你可以设计任何可绘制的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>

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.