Tween动画

1.在关闭电视机的时候,电视机中间都有一根白条瞬间关闭。

  要实现这个效果其实就是利用Tween动画进行实现的。

动画的xml 文件是:

    android:startOffset=""  利用这个属性可以实现动画执行的先后顺序

 <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:zAdjustment="top" > <scale
android:duration="5000"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="0.003" />
<scale
android:duration="3000"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="5000"
android:toXScale="0.0"
android:toYScale="0.3" /> <alpha
android:duration="3000"
android:fillAfter="true"
android:fillEnabled="true"
android:fromAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:startOffset="5000"
android:toAlpha="0" /> <rotate
android:fromDegrees="0.0"
android:toDegrees="360.0"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="true"
android:interpolator="@android:anim/linear_interpolator"
android:duration="5000"
/> </set>

主界面的Activity

 public class MainActivity extends Activity {

     private ImageView back , line;

     private Animation mAnimation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
} private void initView() {
back = (ImageView)findViewById(R.id.img_back);
line = (ImageView)findViewById(R.id.img_line);
mAnimation = AnimationUtils.loadAnimation(MainActivity.this,R.anim.tv_off);
mAnimation.setAnimationListener(new AnimationListener() { @Override
public void onAnimationStart(Animation animation) { } @Override
public void onAnimationRepeat(Animation animation) { } @Override
public void onAnimationEnd(Animation animation) { }
}); line.setVisibility(View.VISIBLE);
line.setAnimation(mAnimation);
// mAnimation.start(); } }
activity_main.xml:
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" > <ImageView
android:id="@+id/img_back"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black" /> <ImageView
android:id="@+id/img_line"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:visibility="gone"
/> </FrameLayout>

源码下载

Android 模仿电视机关闭界面的更多相关文章

  1. Android WebView无法播放视频或直播,关闭界面后任在播放的问题;

    1.设置webview属性: webView.setWebChromeClient(new MyWebChromeClient());         webSettings = webView.ge ...

  2. [转]Android:布局实例之模仿QQ登录界面

    Android:布局实例之模仿QQ登录界面 预览图: 准备: 1.找到模仿对象 QQ登陆界面UI下载>>>>> 2.导入工程 3.查看布局结构和使用控件 其对应效果图分布 ...

  3. Android:布局实例之模仿QQ登录界面

    预览图: 准备: 1.找到模仿对象 QQ登陆界面UI下载>>>>> 2.导入工程 3.查看布局结构和使用控件 其对应效果图分布为 4.分析样式选择器 下拉箭头2种样式:点 ...

  4. Android:布局实例之模仿京东登录界面

    预览图及布局结构参考: 布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout ...

  5. android studio 新建项目 界面一直停在 【“building ‘ 项目名’ gradle project info”】

    zhezhelin android studio 新建项目 界面一直停在 [“building ‘ 项目名’ gradle project info”] 安装了android studio 之后,按照 ...

  6. Android模仿iOS iMessages10照片选择器的实现

    不知不觉已经接近半年多没有写过博客了,这段时间,也是我刚好毕业走出校园的时间,由于学习工作的原因,一直没有真正静下心来写下些什么东西.这个星期刚入了小米笔记本pro的坑,本着新电脑新生活的理念嘻嘻-- ...

  7. android 仿微信聊天界面,以及语音录制功能

    extends:http://104zz.iteye.com/blog/1709840 本例为模仿微信聊天界面UI设计,文字发送以及语言录制UI. 1先看效果图:     第一:chat.xml设计 ...

  8. Android ActionBar仿微信界面

    ActionBar仿微信界面 1.学习了别人的两篇关于ActionBar博客,在结合别人的文章来仿造一下微信的界面: 思路如下:1).利用ActionBar生成界面的头部,在用ActionBar的Ac ...

  9. Stack Overflow 排错翻译 - Closing AlertDialog.Builder in Android -Android环境中关闭AlertDialog.Builder

    Stack Overflow 排错翻译  - Closing AlertDialog.Builder in Android -Android环境中关闭AlertDialog.Builder 转自:ht ...

随机推荐

  1. AIX 第5章 指令记录

    AIX引导过程 AIX不同引导模式 AIX的关闭 AIX的计划任务 AIX服务的管理 AIX的常用日志 POST=Power On Self Test   rc.boot 的三次调用 /etc/ini ...

  2. HALCON基础知识

    HALCON 1. 语法范式 Syntax Style 1.1. 基本格式 1.1.1. 算子格式 算子(输入图像参数:输出图像参数:输入控制参数:输出控制参数) 其中四个参数任意一个可以为空 e.g ...

  3. 【转】搭建Python的Eclipse开发环境之安装PyDev插件--离线安装

    原文网址:http://blog.csdn.net/wangpingfang/article/details/7181223 使用update site安装pydev插件 注意:该安装指南针对ecli ...

  4. RequireJS进阶(一) 转

    为了应对日益复杂,大规模的JavaScript开发.我们化整为零,化繁为简.将复杂的逻辑划分一个个小单元,各个击破.这时一个项目可能会有几十个甚至上百个JS文件,每个文件为一个模块单元.如果上线时都是 ...

  5. 高新服务平台在SUSE系统上重新部署笔录

    安装步骤     ./shutdown.sh 停止tomcat (1) 删除 zjgx 目录下 除bbs 和Demos所有目录和文件 (2)上传zjgx0519.zip 到zjgx目录下 (3)unz ...

  6. PHP Header 缓存 --- Header 参数说明

    1. Accept:告诉WEB服务器自己接受什么介质类型,*/* 表示任何类型,type/* 表示该类型下的所有子类型,type/sub-type. 2. Accept-Charset:   浏览器申 ...

  7. linux 修改时间 - [命令操作]

    我们一般使用“date -s”命令来修改系统时间.比如将系统时间设定成1996年6月10日的命令如下. #date -s 06/10/96 将系统时间设定成下午1点12分0秒的命令如下. #date ...

  8. 嵌入式 Linux下curl库API简单介绍

    1:CURLcode curl_global_init(long flags); 这个函数全局需要调用一次(多次调用也可以,不过没有必要), 所以这也是把Curlplus设计成单体类的原因,curl_ ...

  9. 关于asp.net中页面事件加载的先后顺序

    一.ASP.NET 母版页和内容页中的事件 母版页和内容页都可以包含控件的事件处理程序.对于控件而言,事件是在本地处理的,即内容页中的控件在内容页中引发事件,母版页中的控件在母版页中引发事件.控件事件 ...

  10. Codeforces Round #218 (Div. 2) C题

    C. Hamburgers time limit per test 1 second memory limit per test 256 megabytes input standard input ...