Android 我如何在可拉丝中制作这种渐变?

Android 我如何在可拉丝中制作这种渐变?,android,gradient,Android,Gradient,我使用渐变类型作为扫描,但是startColor从3点钟开始,我如何更改角度 将开始和结束颜色设置为相同和不同的中心颜色,并将centerX和centerY设置为0.5 试试这个 <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:type="sweep" android:cente

我使用渐变类型作为扫描,但是
startColor
从3点钟开始,我如何更改角度


将开始和结束颜色设置为相同和不同的中心颜色,并将centerX和centerY设置为0.5

试试这个

<shape xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="rectangle">
   <gradient
    android:type="sweep"
    android:centerY="0.5"
    android:centerX="0.5"
    android:centerColor="#303F9F"
    android:endColor="#3F51B5"
    android:startColor="#3F51B5" />
</shape>

从代码中删除角度,并给安卓:centerY=“0.5”和安卓:centerX=“0.5”您的问题将得到解决

<shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle">
<gradient
    android:type="sweep"
    android:centerColor="#FA364D"
    android:endColor="#212545"
    android:startColor="#212545" 
    android:centerY="0.5"
    android:centerX="0.5"/>
</shape>

我找到了一种方法

<?xml version="1.0" encoding="utf-8"?>
    <shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval"
    >
    <gradient
        android:type="sweep"
        android:startColor="#212545"
        android:centerColor="#FA364D"
        android:endColor="#212545"/>
</shape>


我用上面的背景创建了
TextView
android:rotation=“135”
android:scaleX=“99”
android:scaleY=“99”

只需旋转你的绘图工具即可/view@VladMatvienko当我旋转视图时,视图周围会有空格添加问题代码我没有使用“角度”,还有“安卓:cenerX”和“安卓:centerY”都不起作用。你参加了我问题图片中的角度吗?