android - Rotating refresh button -
i have refresh button defined in layout file follow:
<imagebutton android:id="@+id/btn_refresh_assets" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:onclick="onclick" android:src="@drawable/ic_menu_refresh" />
when button clicked, asynctask
called load data webservice. want rotate refresh icon until load complete!!! there guidlines doing in actionbar button placed in middle of page , not in actionbar.
here code
animation animation = new rotateanimation(0.0f, 360.0f, animation.relative_to_self, 0.5f, animation.relative_to_self, 0.5f); animation.setrepeatcount(-1); animation.setduration(2000);
create animation
before starting service attach animation imageview below
((imageview)findviewbyid(r.id.btn_refresh_assets)).setanimation(animation);
and when service ends
((imageview)findviewbyid(r.id.btn_refresh_assets)).clearanimation();
Comments
Post a Comment