IllegalArgumentException: radius must be > 0

北战南征 提交于 2019-12-05 00:31:16

If you are having this issue on Android L (5.0), I have noticed that GradientDrawable does not accept the "%" suffix. So instead, I have used the "%p" suffix, and it works. Also, I needed to change my absurdly high value (80000%) with a normal value (80%p), and now it looks proper.

So, I have created a "drawable-v21" folder (from which Android L will take its drawables), copied my shape xml which contains the gradient and changed this line:

android:gradientRadius="80000%"

with this

android:gradientRadius="80%p"

In my case i added android:gradientRadius="30dp".

That dp at the end was trowing the same exception on some devices.

Leave it android:gradientRadius="30" or use the @radu122 's answer

For me problem was in cardview's app:cardCornerRadius="0dp" https://stackoverflow.com/a/43864791/6055194

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!