android valueanimator for relativelayout with textview inside is laggy -
i trying animate changes of layout width. layout element i'm trying animate relativelayout. contains textview positioned rule align_parent_bottom. i'm creating code extending relativelayout viewgroup.
the following part of constructor:
1 title = new textview(c); 2 layoutparams tvparams = new layoutparams(layoutparams.match_parent, layoutparams.wrap_content); 3 tvparams.addrule(align_parent_bottom); 4 title.setlayoutparams(tvparams); 5 title.settext(this.feed.title); 6 this.addview(title);
and valueanimator:
mscalex = valueanimator.ofint(mparamsoriginal.width, mparamslarge.width); mscalex.setinterpolator(new linearinterpolator()); mscalex.addupdatelistener(new valueanimator.animatorupdatelistener() { @override public void onanimationupdate(valueanimator valueanimator) { int val = (integer) valueanimator.getanimatedvalue(); linearlayout.layoutparams layoutparams = (linearlayout.layoutparams) getlayoutparams(); layoutparams.width = val; requestlayout(); } });
the thing comment rows 2-4 , put textview on layout works fine. otherwise profiler says causes constant re-measurement of view , device spends 90% of processor time on it.
so, there way solve issue?
Comments
Post a Comment