Android - How to draw an arc based gradient

后端 未结 3 1540
梦毁少年i
梦毁少年i 2020-12-04 19:54

I am trying to create an arc (variable number of degrees) that gradually goes from one color to another. From example from blue to red:

3条回答
  •  無奈伤痛
    2020-12-04 20:23

    five years later, but the right way is make 0.749f with 0.750f of the separate line, simple code is like:

        val colors = intArrayOf(0xffff0000.toInt(), 0xff0000ff.toInt(), 0xffff0000.toInt(), 0xffff0000.toInt())
        val positions = floatArrayOf(0.0f, 0.749f, 0.750f, 1.0f)
    

提交回复
热议问题