android - Centering a circular reveal animation -


i'm trying create circular reveal animation starts @ center of view (api 21+). tried using averages of view.getleft() , view.getright() x , view.gettop() , view.getbottom() y (which sample does, if view offset coordinatorlayout, values wrong. i'm grabbing values in onpredrawlistener, view has been measured.

i've found using view.getdrawingrect() trick.

private animator createcenteredreveal(view view) {   // optimize reusing temporary rect instead of allocating new 1   rect bounds = new rect();   view.getdrawingrect(bounds);   int centerx = bounds.centerx();   int centery = bounds.centery();   int finalradius = math.max(bounds.width(), bounds.height());   return viewanimationutils.createcircularreveal(view, centerx, centery, 0f, finalradius); } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -