博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Animating Layout Changes 动画布局的更改
阅读量:4047 次
发布时间:2019-05-24

本文共 1244 字,大约阅读时间需要 4 分钟。

A layout animation is a pre-loaded animation that the system runs each time you make a change to the layout configuration. All you need to do is set an attribute in the layout to tell the Android system to animate these layout changes, and system-default animations are carried out for you.

Tip: If you want to supply custom layout animations, create a object and supply it to the layout with the method.

Here's what a default layout animation looks like when adding items to a list: http://blog.csdn.net/sergeycao
 

If you want to jump ahead and see a full working example, and run the sample app and select the Crossfade example. See the following files for the code implementation:

  1. src/LayoutChangesActivity.java
  2. layout/activity_layout_changes.xml
  3. menu/activity_layout_changes.xml

Create the Layout

In your activity's layout XML file, set the android:animateLayoutChanges attribute to true for the layout that you want to enable animations for. For instance:

Add, Update, or Remove Items from the Layout

Now, all you need to do is add, remove, or update items in the layout and the items are animated automatically:

private ViewGroup mContainerView;...private void addItem() {    View newView;    ...    mContainerView.addView(newView, 0);}
你可能感兴趣的文章
mysql5.6.34 升级到mysql5.7.32
查看>>
dba 常用查询
查看>>
Oracle 异机恢复
查看>>
Oracle 12C DG 搭建(RAC-RAC/RAC-单机)
查看>>
Truncate 表之恢复
查看>>
Oracle DG failover 后恢复
查看>>
mysql 主从同步配置
查看>>
为什么很多程序员都选择跳槽?
查看>>
mongdb介绍
查看>>
mongdb安装使用
查看>>
mongdb在java中的应用
查看>>
区块链技术让Yotta企业云盘为行政事业服务助力
查看>>
Yotta企业云盘更好的为媒体广告业服务
查看>>
Yotta企业云盘助力旅游行业新发展
查看>>
Yotta企业云盘助力科技行业创高峰
查看>>
Yotta企业云盘更好地为教育行业服务
查看>>
Yotta企业云盘怎么帮助到能源化工行业
查看>>
企业云盘如何助力商业新发展
查看>>
医疗行业运用企业云盘可以带来什么样的提升
查看>>
教育数字智能化能为现有体系带来新的起点
查看>>