Skip to content

Instantly share code, notes, and snippets.

@TimCastelijns
Created November 9, 2018 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TimCastelijns/8c53b53acdd11f4e1fd3aabf8ce5847b to your computer and use it in GitHub Desktop.
Save TimCastelijns/8c53b53acdd11f4e1fd3aabf8ce5847b to your computer and use it in GitHub Desktop.
onSizeChanged with linear gradient set up
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
val colors = intArrayOf(
typedArray.getColor(R.styleable.SlickGraph_gradColorStart, defaultColor),
typedArray.getColor(R.styleable.SlickGraph_gradColorEnd, defaultColor)
)
val gradient = LinearGradient(
0f,
0f,
0f,
h.toFloat(),
colors,
null,
Shader.TileMode.CLAMP
)
gradientPaint = Paint()
gradientPaint.style = Paint.Style.FILL
gradientPaint.shader = gradient
}
@raghunandankavi2010
Copy link

raghunandankavi2010 commented Nov 9, 2018

i got this. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment