当前位置: 首页 > news >正文

家教网站如何做/百度指数排行榜

家教网站如何做,百度指数排行榜,网站建设比较合理的流程是,36kr网站用什么做的AnimationListener的使用方法 1.AnimationListener是一个监听器,该监听器在动画执行的各个阶段会得到通知,从而调用相应的方法; 2.AnimationListener主要包括如下三个方法: onAnimationEnd(Animation animation) - 当动画结束时调…

AnimationListener的使用方法

       1.AnimationListener是一个监听器,该监听器在动画执行的各个阶段会得到通知,从而调用相应的方法;

       2.AnimationListener主要包括如下三个方法:

              ·onAnimationEnd(Animation animation) - 当动画结束时调用

              ·onAnimationRepeat(Animation animation) - 当动画重复时调用

              ·onAniamtionStart(Animation animation) - 当动画启动时调用

直接上demo测试程序:实现的功能是:当要删除图片时,图片会慢慢的渐隐消去;当图片添加进来是,图片慢慢的显示出来

AnimationListenerActivity.java

package com.example.androidanimationlistenerdemos;import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.Button;
import android.widget.ImageView;public class AnimationListenerActivity extends Activity {private Button addButton = null;private Button deleteButton = null;private ImageView imageView = null;private ViewGroup viewGroup = null;@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);addButton = (Button) findViewById(R.id.addButton);deleteButton = (Button) findViewById(R.id.deleteButton);imageView = (ImageView) findViewById(R.id.image);// LinearLayout下的一组控件viewGroup = (ViewGroup) findViewById(R.id.layout);addButton.setOnClickListener(new AddButtonListener());deleteButton.setOnClickListener(new DeleteButtonListener());}private class AddButtonListener implements OnClickListener {public void onClick(View v) {// 淡入AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f);animation.setDuration(1000);animation.setStartOffset(500);// 创建一个新的ImageView/** ImageView newImageView = new ImageView(* AnimationListenerActivity.this);* newImageView.setImageResource(R.drawable.image);* viewGroup.addView(newImageView, new LayoutParams(* LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));* newImageView.startAnimation(animation);*/imageView = new ImageView(AnimationListenerActivity.this);imageView.setImageResource(R.drawable.image);viewGroup.addView(imageView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));imageView.startAnimation(animation);}}private class DeleteButtonListener implements OnClickListener {public void onClick(View v) {// 淡出AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f);animation.setDuration(1000);animation.setStartOffset(500);// 为Aniamtion对象设置监听器animation.setAnimationListener(new RemoveAnimationListener());imageView.startAnimation(animation);}}private class RemoveAnimationListener implements AnimationListener {// 动画效果执行完时removepublic void onAnimationEnd(Animation animation) {System.out.println("onAnimationEnd");viewGroup.removeView(imageView);}public void onAnimationRepeat(Animation animation) {System.out.println("onAnimationRepeat");}public void onAnimationStart(Animation animation) {System.out.println("onAnimationStart");}}
}

布局文件xml:main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/layout"android:orientation="vertical" android:layout_width="fill_parent"android:layout_height="fill_parent"><Button android:id="@+id/addButton" android:layout_width="fill_parent"android:layout_height="wrap_content" android:layout_alignParentBottom="true"android:text="添加图片" /><Button android:id="@+id/deleteButton" android:layout_width="fill_parent"android:layout_height="wrap_content" android:layout_above="@id/addButton"android:text="删除图片" /><ImageView android:id="@+id/image"android:layout_width="wrap_content" android:layout_height="wrap_content"android:layout_centerInParent="true" android:layout_marginTop="100dip"android:src="@drawable/image" />
</RelativeLayout>

 

drawable[-***]目录下放一张image.png图片

demo 下载:http://pan.baidu.com/s/1gdnGswj

 

转载于:https://www.cnblogs.com/MMLoveMeMM/articles/4208967.html

http://www.lbrq.cn/news/1469899.html

相关文章:

  • 电商网站seo怎么做/优化服务公司
  • wordpress自定义文章类型/网站上不去首页seo要怎么办
  • 网站建设里的知识/怎么从网上找客户
  • 个人建站平台/关键词搜索排名公司
  • 网站开发细节/深圳网络络推广培训
  • 网站没被收录/关键词优化排名哪家好
  • 网站建设售后培训/网络营销教程
  • 阿里云怎么做淘宝客网站/怎么弄一个自己的链接
  • 电脑做网站主机/人民日报最新头条10条
  • 营销型的网站/seo零基础教学视频
  • 自己做网站的二维码/服务网站排名咨询
  • 白城网站建设/东莞网站优化关键词排名
  • 做网站公证需要费用是多少/黄页引流推广网站软件免费
  • 学做彩票网站有哪些/深圳网站建设方案
  • 建设电子商务网站前的市场分析/百度app手机版
  • 做视频网站视频放在哪里/广告免费发布信息平台
  • 青岛外贸假发网站建设/高清免费观看电视网站
  • 邯郸企业做网站报价/郑州网站seo服务
  • 广州市网站公司/线上广告接单平台
  • 青岛在线制作网站/长沙seo行者seo09
  • 网站是用dw做的吗/品牌全案营销策划
  • 为什么要给企业建设网站/微信营销方式
  • 做企业培训的网站/网络推广服务费
  • 网站制作公司 知乎/友情链接交换平台免费
  • 电商网站策划书/打开百度一下
  • 制作企业网站的app/石家庄seo扣费
  • phpcms v9网站建设入门/磁力天堂最佳搜索引擎入口
  • wordpress 福利源码/六年级下册数学优化设计答案
  • 中英文网站建设费用/做网站用什么软件
  • 张家界做网站的人/日本樱花免m38vcom费vps
  • 暑期算法训练.12
  • SpringBoot与Rust实战指南
  • 数论:卢卡斯定理
  • 无公网IP设置外网可访问本地瑞友天翼应用虚拟化系统
  • Java实习面试记录
  • 《Java 程序设计》第 18 章 - Java 网络编程