public class applaudAnimation extends Activity implements OnClickListener {    private Button button;    private TextView textView;    private android.view.animation.Animation animation;    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.animation);        animation = AnimationUtils.loadAnimation(this,R.anim.applaud_animation);        button = (Button) findViewById(R.id.bt);        button.setOnClickListener(this);        textView = (TextView) findViewById(R.id.animation);    }    @Override    public void onClick(View v) {        if (v == button) {            textView.setVisibility(View.VISIBLE);            textView.startAnimation(animation);            new Handler().postDelayed(new Runnable() {                public void run() {                    textView.setVisibility(View.GONE);                }            }, 1000);        }    }}

animation.xml

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffff" >    <Button  android:id="@+id/bt" android:layout_width="40dip" android:layout_height="wrap_content" android:layout_centerInParent="true" android:gravity="center" android:text="赞" android:textColor="#000000" android:textSize="18dip" />    <TextView  android:id="@+id/animation" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:gravity="center" android:text="+1" android:textColor="#FF0000" android:textSize="18dip" android:visibility="gone" /></RelativeLayout>

applaud_animation.xml

<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android">  <translate  android:fromXDelta="0" android:toXDelta="0" android:fromYDelta="0" android:toYDelta="-50" android:duration="1000"/>  <alpha android:fromAlpha="1.0" android:toAlpha="0.3" android:duration="1000"/></set>

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. mysql 5.7.17 安装图文教程(windows)
  2. mysql中异常错误ERROR:2002的解决方法
  3. MySQL中使用replace、regexp进行正则表达
  4. 数据库账号密码加密详解及实例
  5. mysql基于正则实现模糊替换字符串的方法
  6. MySQL数据库的shell脚本自动备份
  7. mysql delete 多表连接删除功能
  8. mysql 5.7.11 zip安装配置方法图文教程
  9. MySQL安装提示"请键入NET HELPMSG 3534以
  10. win10下mysql 5.7.17 zip压缩包版安装教