Android layoutAnimation详解及应用
作者:小_源 发布时间:2022-11-01 11:15:07
标签:Android,layoutAnimation
Android layoutAnimation详解及应用
前言:
最近在玩一个APP的时候,发现刚进入他的页面,他页面的子控件都是从右侧飞过来的,感觉好牛逼的样子,就顺便模仿了一个。看着确实是比死板呆在那舒服多了!
还是感觉很好看!反正我觉得比死板呆在那好看!你们觉得那!
在看咱们模仿的:
差不多,在微调一下就好了!
上点代码,其实很简单:
首先新建一个anim文件夹在里面新建两个xml
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:delay="90%" //空间的执行间隔
android:animation="@anim/trans" />
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
<translate
android:fromXDelta="100%p" android:toXDelta="0"
android:duration="200" />
<alpha
android:fromAlpha="0" android:toAlpha="1"
android:duration="200"
/>
</set>
只要把这个动画在布局里面设置一下就出现这个效果,碉堡了!
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#e6e6e6"
android:layoutAnimation="@anim/anim"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|left"
android:background="#ffffff"
android:layout_margin="5dip"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|left"
android:background="#ffffff"
android:layout_margin="5dip"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|left"
android:background="#ffffff"
android:layout_margin="5dip"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|left"
android:background="#ffffff"
android:layout_margin="5dip"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|left"
android:background="#ffffff"
android:layout_margin="5dip"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|left"
android:background="#ffffff"
android:layout_margin="5dip"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|left"
android:background="#ffffff"
android:layout_margin="5dip"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
</LinearLayout>
就这么简单的几句话,感觉用户体验顿时上升了不少!真是细节决定成败啊!
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
来源:http://blog.csdn.net/xiaoyuan511/article/details/45222543
0
投稿
猜你喜欢
- Java 8中引入了CompletableFuture类,它是一种方便的异步编程工具,可以处理各种异步操作,如网络请求、文件IO和数据库操作
- 大家好,我是程序员田同学!今天上午收到一个需求,针对当前的系统开发一个对外开放的接口。既然是对外开放,那么调用者一定没有我们系统的Token
- gcc 命令使用 gcc 编译 c语言-c 编译、汇编到目标代码,不进行链接,也就是直接生成目标文件-o 将输出的文件以指定文件名来储存,有
- 本文实例为大家分享了Unity3D实现物体排成弧行的具体代码,供大家参考,具体内容如下一般用在Pico、HTC、DP等VR设备中效果:完整代
- 前言什么是mybatis二级缓存?二级缓存是多个sqlsession共享的,其作用域是mapper的同一个namespace。即,在不同的s
- 本文以一个实例的形式讲述了C#实现复杂XML的序列化与反序列化的方法。分享给大家供大家参考。具体方法如下:已知.xml(再此命名defaul
- 一、需求分析最近公司项目要实现一个需求要满足以下功能: 1)显示一个 list
- 断言的概念断言用于证明和测试程序的假设,比如“这里的值大于 5”。断言可以在运行时从代码中完全删除,所以对代码的运行速度没有影响。断言的使用
- 整型变量基本语法格式int变量名= 初始值;代码示例int a = 10;int表示变量的类型是一个整型。在 Java 中, 一个int变量
- 下面的代码将发生死循环:package com.zzj.concurrency;public class VolatileObjectTes
- 一、前言又见面了哈,今天为大家介绍时钟、钟表的实现方法教程。实现的方法有很多,这里只是提供了一个思路,本着抛砖引玉的心态,希望能和大家共同学
- Android自定义SwipeLayout仿QQ侧滑条目,供大家参考,具体内容如下先看动图 看布局文件activity_main.xml&l
- 在Spring Boot中,Spring Boot会自动搜索映射的Entity,并且创建相应的table,但是有时候我们希望自定义某些内容,
- 当我们在spring容器中添加一个bean时,如果没有指明它的scope属性,则默认是singleton,也就是单例的。例如先声明一个bea
- 闭锁相当于一扇门,在闭锁到达结束状态之前,这扇门一直是关闭着的,没有任何线程可以通过,当到达结束状态时,这扇门才会打开并容许所有线程通过。它
- 本文实例讲述了Java Swing实现窗体添加背景图片的2种方法。分享给大家供大家参考,具体如下:在美化程序时,常常需要在窗体上添加背景图片
- 如果 d:\upload\file\ 文件夹不存在,会报错String strPath = "d:\\upload\\file\\
- 当前比较成熟一点的应用基本上都会在进入应用之显示一个启动界面.这个启动界面或简单,或复杂,或简陋,或华丽,用意不同,风格也不同.下面来观摩几
- java模拟TCP通信实现客户端上传文件到服务器端,供大家参考,具体内容如下客户端package com.zr;import java.io
- 前言列表是移动应用中用得最多的组件了,我们也会经常对列表元素进行增加或删除操作,最简单的方法是列表数据变动后,直接 setStat