Android 模仿电视机关闭界面
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 模仿电视机关闭界面的更多相关文章
- Android WebView无法播放视频或直播,关闭界面后任在播放的问题;
1.设置webview属性: webView.setWebChromeClient(new MyWebChromeClient()); webSettings = webView.ge ...
- [转]Android:布局实例之模仿QQ登录界面
Android:布局实例之模仿QQ登录界面 预览图: 准备: 1.找到模仿对象 QQ登陆界面UI下载>>>>> 2.导入工程 3.查看布局结构和使用控件 其对应效果图分布 ...
- Android:布局实例之模仿QQ登录界面
预览图: 准备: 1.找到模仿对象 QQ登陆界面UI下载>>>>> 2.导入工程 3.查看布局结构和使用控件 其对应效果图分布为 4.分析样式选择器 下拉箭头2种样式:点 ...
- Android:布局实例之模仿京东登录界面
预览图及布局结构参考: 布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout ...
- android studio 新建项目 界面一直停在 【“building ‘ 项目名’ gradle project info”】
zhezhelin android studio 新建项目 界面一直停在 [“building ‘ 项目名’ gradle project info”] 安装了android studio 之后,按照 ...
- Android模仿iOS iMessages10照片选择器的实现
不知不觉已经接近半年多没有写过博客了,这段时间,也是我刚好毕业走出校园的时间,由于学习工作的原因,一直没有真正静下心来写下些什么东西.这个星期刚入了小米笔记本pro的坑,本着新电脑新生活的理念嘻嘻-- ...
- android 仿微信聊天界面,以及语音录制功能
extends:http://104zz.iteye.com/blog/1709840 本例为模仿微信聊天界面UI设计,文字发送以及语言录制UI. 1先看效果图: 第一:chat.xml设计 ...
- Android ActionBar仿微信界面
ActionBar仿微信界面 1.学习了别人的两篇关于ActionBar博客,在结合别人的文章来仿造一下微信的界面: 思路如下:1).利用ActionBar生成界面的头部,在用ActionBar的Ac ...
- Stack Overflow 排错翻译 - Closing AlertDialog.Builder in Android -Android环境中关闭AlertDialog.Builder
Stack Overflow 排错翻译 - Closing AlertDialog.Builder in Android -Android环境中关闭AlertDialog.Builder 转自:ht ...
随机推荐
- 【英语】Bingo口语笔记(75) - 元音辅音的辨读
- Python 字典(Dictionary) get()方法
描述 Python 字典(Dictionary) get() 函数返回指定键的值,如果值不在字典中返回默认值. 语法 get()方法语法: dict.get(key, default=None) 参数 ...
- MySQL与Oracle 差异比较之三函数
函数 编号 类别 ORACLE MYSQL 注释 1 数字函数 round(1.23456,4) round(1.23456,4) 一样:ORACLE:select round(1.23456,4) ...
- 题目1003:A+B ---c_str(),atoi()函数的使用;remove , erase函数的使用
#include<stdio.h> #include<stdlib.h> int sw(char *a){ ,c=; while(a[i]){ ') c=c*+a[i]-'; ...
- html --- ajax --- javascript --- 简单的封装
Ajax的简单封装 Ajax的全称是AsynchronousJavaScriptAndXML 如有疑问请参考:http://zh.wikipedia.org/zh-cn/AJAX 以及传智播客的视频教 ...
- STL六大组件之——算法小小小小的解析
参考自侯捷的<stl源码剖析> stl算法主要分为非可变序列算法(指不直接修改其所操作的容器内容的算法),可变序列算法(指可以修改它们所操作的容器内容的算法),排序算法(包括对序列进行排序 ...
- MATLAB 通过二进制读写文件
这几天在做信息隐藏方面的应用,在读写文本文件时耗费许久,故特别的上网学习一二,这里给出一常用读写,其他的都类似. 很多时候,我们都要将一个.txt以二进制方式读出来,操作后在恢复成.txt文本. ma ...
- 通知(Toast+Notification)
Toast简要说明:(前面已经用过好多次了) Toast是一种非持久的(在屏幕上面留一会儿就消失了),提供给用户简洁提示信息的视图. 它不阻断用户的操作,一般用于显示一些不重要的信息.(比方说设置音量 ...
- 使用ncc分析代码
1 ncc是一个编译器, 用于输出程序的一些调用信息等, 可以查看函数调用关系, 支持函数指针, 查看数据结构和代码. 可以用来分析和理解代码. “" ... with ncc, in le ...
- [转]对Android开发者有益的40条优化建议
下面是开始Android编程的好方法: 找一些与你想做事情类似的代码 调整它,尝试让它做你像做的事情 经历问题 使用StackOverflow解决问题 对每个你像添加的特征重复上述过程.这种方法能够激 ...