点击赞时弹出+1向上弹出动画

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);}@Overridepublic 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">  <translateandroid: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. 收藏一个 漂亮的 Android加载中动画AVLoadingIndicatorView
  2. Android 手势滑动动画效果收集整理
  3. Android 动画--使用Path来规划动画的轨迹
  4. 动画的顺序播放
  5. Android显示GIF动画完整示例(二)
  6. Android 用属性动画自定义view的渐变背景
  7. android 属性动画之 ObjectAnimator
  8. Android 自定义SurfaceView实现加载GIF动画
  9. Android 动画效果学习笔记

随机推荐

  1. Android项目打包遇com.android.builder.i
  2. Android app升级完成以后自动重启自身App
  3. android中向通过contentProvider向数据库
  4. Android 多扩展布局ChipGroup使用
  5. react-native 禁止横屏
  6. android EasyPermissions 使用教程
  7. android中MVP模式(一)
  8. 获取组件坐标系
  9. Android ContentProvider原理分析
  10. BroadcastReceiver开机启动Service,并在se