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. mysql在update时,从其他select结果集更新表

    需要使用join,例如 select g.id,g.res_count,count(gr.r_id) cnt from mb_game_res gr left join mb_game g on gr ...

  2. 【英语】Bingo口语笔记(56) - “令人失望”的表达

  3. 几款免费的不用数据库的php的cms

    免费不用数据库的php的cms 下面的几种内容采集系统都是英文版的,全部不需使用数据库,都是国外的免费并且开源CMS.对中文支持如何,你自己试试吧! 1.MuCMS一个小型,平台独立的内容管理系统适用 ...

  4. 【转】Undefined symbols for architecture i386:和"_OBJC_CLASS_$_xx", referenced from:问题解决方法

    多个人共同操作同一个项目或拷贝项目时,经常会出现类似这样的问题: Undefined symbols for architecture i386: "_OBJC_CLASS_$_xx文件名& ...

  5. mysql数据库中查询汉字的拼音首字母

    本人提供的方法有如下特点: 1.代码精简,使用简单,只要会基本的SQL语句就行2.不用建立mysql 函数等复杂的东西3.汉字库最全,可查询20902个汉字 方法如下: 1.建立拼音首字母资料表Sql ...

  6. c#枚举自定义,用于数据绑定。 z

    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Enum)] public ...

  7. android edittext不弹出软键盘

    方法一: 在AndroidMainfest.xml中选择哪个activity,设置windowSoftInputMode属性为adjustUnspecified|stateHidden 例如:< ...

  8. 【Mongo】MongoVUE的使用

    我一直是在终端操作的mongo,各种update set remove insert,后来查了下有个叫mongoVUE的客户端,界面化比较方便操作吧~ 网上搜了下,说MongoVUE已经n年没有更新了 ...

  9. [转]Linux下which、whereis、locate、find 命令的区别

    转自:http://312788172.iteye.com/blog/730280 我们经常在linux要查找某个文件,但不知道放在哪里了,可以使用下面的一些命令来搜索.这些是从网上找到的资料,因为有 ...

  10. [转]Loadrunner11之VuGen运行时设置Run-Time Setting

    转自:http://www.51testing.com/html/92/450992-248065.html General 1.Run Logic运行逻辑 脚本如何运行的,每个action和acti ...