android - Animate pie diagram as a background of TextView from one state to another -
i setting background of textview
in android pie diagram. have used layerdrawable
of arcshape
(s) , set background. here code that:
final shapedrawable arcgreen = new shapedrawable(new arcshape(-90, correctangle)); arcgreen.getpaint().setcolor(contextcompat.getcolor(this, r.color.feedback_score_3)); final shapedrawable arcred = new shapedrawable(new arcshape(-90 + correctangle, 360 - correctangle)); arcred.getpaint().setcolor(contextcompat.getcolor(this, r.color.feedback_score_1)); final drawable[] layer = {arcgreen, arcred, mask}; final layerdrawable ld = new layerdrawable(layer); msvaralayout.getchildat(i).setbackground(ld);
now, want animate background when value of correctangle
changes. 1 of options see use valueanimator
, go initial value new correctvalue
, each time inside onanimationupdate()
callback create new layerdrawable
object changed values , set background. other way have been drawables
(s) in background first(which shapedrawable(<arcshape>)
objects , set angles of arcs. guess there no way so. there other way achieve this?
Comments
Post a Comment