Why Doesn't This Argument Of The Lineargradient Constructor Seem To Work?
I want to set a custom drawable with a linear gradient as the background drawable of the bar in my SeekBar. I am creating the LinearGradient in the second statement in the followin
Solution 1:
use
ShapeDrawable#setShaderFactory(ShapeDrawable.ShaderFactory factory)
the factory has a method Shader resize(int width, int height)
which is called every time your drawable bounds change and this is a place where you should return your LinearGradient
shader based on width
/ height
parameters
as you will see you can now just pass null positions
and colors will be distributed evenly
Post a Comment for "Why Doesn't This Argument Of The Lineargradient Constructor Seem To Work?"