将Menu菜单项显示在ActionBar上,这里显示一个刷新按钮,模拟在刷新动作时的添加刷新动画
菜单布局
menu.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/action_stop" android:orderInCategory="100" android:showAsAction="always" android:title="@string/action_stop"/> <item android:id="@+id/action_refresh" android:orderInCategory="100" android:showAsAction="always" android:icon="@drawable/ic_action_refresh" /> </menu>
显示旋转动画的view refresh_view.xml
<ImageView xmlns:android="http://schemas.android.com/apk/res/android" style="@android:style/Widget.ActionButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scaleType="centerInside" a