【发布时间】:2016-12-13 05:48:07
【问题描述】:
我像这样创建SweepGradient
int[] colors = { Color.RED, Color.BLUE };
// float[] positions = {0,1}; => this will work without error
float[] positions = { 0 , 280f/360 };
SweepGradient gradient = new SweepGradient(width / 2, height / 2, colors, positions);
当我设置float[] positions = {0,1} 时,它会正常工作(没有错误)。
当我更改为float[] positions = { 0 , 280f/360 } 时,在Preview mode of AndroidStudio 中显示渲染错误,但在模拟器中它工作正常
为什么会这样?我该如何解决?
【问题讨论】:
-
预览不准确,可能渲染不正确。这是一个普遍的问题,并且不会很快解决。忽略预览错误,直到它在设备上运行
标签: android indexoutofboundsexception sweepgradient