Android ActionBar中的按钮添加旋转动画

这篇博客介绍了如何在Android应用的ActionBar中添加一个刷新按钮,并实现点击时的旋转动画效果。通过菜单布局、设置动画属性以及在Activity中进行相关操作,展示了点击停止动画的功能。同时,文中还提到了其他Android开发的相关话题,如AlertDialog的使用、shareSDK的SSO登录以及MySQL的B-Tree索引等。
摘要由CSDN通过智能技术生成

将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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值