android - How to show Indeterminate Progress bar when Refresh button is pressed in ActionBarSherlock? -
how show indeterminate progressbar when refresh button pressed in actionbarsherlock , again show refresh button when viewgroup on refreshed?
update 1: have answer here incomplete. placing bounty on question more developers can build answer can useful others in future.
how can show indeterminate progressbar looks 1 shown in image below
it seems actionbarsherlock doesn't provide specific method animate refresh menuitem.
what can (by using classic android api) use setactionview(int resid) method , give id of layout progressbar in it.
at beginning of refresh action call :
item.setactionview(r.layout.refresh_menuitem); and when refresh action finished call :
item.setactionview(null); here sample of layout file refresh_menuitem.xml can have :
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:addstatesfromchildren="true" android:focusable="true" android:paddingleft="4dp" android:paddingright="4dp" android:gravity="center" style="?attr/actionbuttonstyle"> <progressbar android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" style="@android:style/widget.progressbar.small"/> </linearlayout>
Comments
Post a Comment