当前位置: 首页 > news >正文

东莞企业自助建站系统佛山抖音seo

东莞企业自助建站系统,佛山抖音seo,上海seo网站,长春百度seo排名接前篇 Android View动画整理 ,本篇介绍 LayoutAnimation 的使用。 参考《安卓开发艺术探索》。 View 动画作用于 View 。 LayoutAnimation 则作用于 ViewGroup , 为 ViewGoup 指定一个动画,ViewGoup 的子 View 出场时就具体动画效果。 简言…

接前篇 Android View动画整理 ,本篇介绍 LayoutAnimation 的使用。

参考《安卓开发艺术探索》。

View 动画作用于 View 。
LayoutAnimation 则作用于 ViewGroup , 为 ViewGoup 指定一个动画,ViewGoup 的子 View 出场时就具体动画效果。
简言之,LayoutAnimation 是为 ViewGroup 的子View指定出场动画。

开始使用,两种方式,xml 方式 和 java 方式 。

xml 方式

创建 R/anim/layout_anim_item.xml ,这个是子View的出场动画,实际的动画效果,本例为平移加透明度动画。

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"android:duration="1000"android:shareInterpolator="true"android:interpolator="@android:anim/accelerate_interpolator"><alpha android:fromAlpha="0.0" android:toAlpha="1.0"/><translate android:fromXDelta="800" android:toXDelta="0"/>
</set>

定义 LayoutAnimation ,创建 R/anim/layout_anim.xml ,

<?xml version="1.0" encoding="utf-8"?>
<layoutAnimationxmlns:android="http://schemas.android.com/apk/res/android"android:animationOrder="normal"android:delay="0.5"android:animation="@anim/layout_anim_item">
</layoutAnimation>
  • android:animationOrder :子 View 动画的顺序,可选 normal 、reverse 、random 。normal 是排在前面的子View先开始动画;reverse 是排在后面的子View先开始动画;random 是子View随机播放动画。

  • android:delay :子View 开始动画的时间延迟。源码里的说明 child animation delay = child index * delay * animation duration ,即 1000 毫秒的动画,第1个子View 延迟 500 毫秒(1 * 0.5 * 1000)播放入场动画,第2个子View 延迟 1000 毫秒(2 * 0.5 * 1000)播放入场动画。

  • android:animation :指定子View的出场动画,实际的动画效果。

为 ViewGoup 的指定 android:layoutAnimation 属性,如

<LinearLayout<!-- -->android:layoutAnimation="@anim/layout_anim"<!-- --> >

贴下本例的 xml ,是一个 LinearLayout 包含多个其他控件,

<LinearLayoutandroid:id="@+id/ll_layout_anim"android:layout_width="400dp"android:layout_height="wrap_content"android:layout_marginTop="16dp"android:orientation="vertical"android:layoutAnimation="@anim/layout_anim"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"app:layout_constraintVertical_bias="0.129"><TextViewandroid:textSize="20sp"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="TextView1"android:textColor="@color/my_red"/><TextViewandroid:textSize="20sp"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="TextView2"android:textColor="@color/purple_500"/><TextViewandroid:textSize="20sp"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="TextView3"android:textColor="@color/black"/><TextViewandroid:textSize="20sp"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="TextView4"android:textColor="@android:color/holo_green_light"/><ImageViewandroid:layout_width="40dp"android:layout_height="40dp"android:background="@drawable/ic_red_cycle"/><Buttonandroid:text="Button"android:layout_width="wrap_content"android:layout_height="wrap_content"/><ImageViewandroid:layout_width="200dp"android:layout_height="100dp"android:background="@drawable/pic_beauty"/></LinearLayout>

至此,OK。运行效果,
在这里插入图片描述

java 方式

通过 LayoutAnimationController 实现。

用前面提到的 R/anim/layout_anim_item.xml 动画文件,

创建动画 animation ,创建 LayoutAnimationController ,ViewGroup.setLayoutAnimation(LayoutAnimationController controller) ,

	public void onLAButtonClick(View view) {if (view.getId() == R.id.button_la_hide) {mLinearLayout.setVisibility(View.INVISIBLE);} else if (view.getId() == R.id.button_la_show) {mLinearLayout.setVisibility(View.VISIBLE);Animation animation = AnimationUtils.loadAnimation(this, R.anim.layout_anim_item);LayoutAnimationController controller = new LayoutAnimationController(animation);controller.setDelay(0.5f);//controller.setOrder(LayoutAnimationController.ORDER_NORMAL);controller.setOrder(LayoutAnimationController.ORDER_REVERSE);//controller.setOrder(LayoutAnimationController.ORDER_RANDOM);mLinearLayout.setLayoutAnimation(controller);}}

很简单,完成,运行效果:
在这里插入图片描述

http://www.yidumall.com/news/107337.html

相关文章:

  • 做网站前的准备什么软件深圳发布最新通告
  • 上海网络做网站公司seo顾问服务公司站长
  • 学校网站管理方案百度快速收录权限
  • 海天建设集团有限公司网站google关键词搜索技巧
  • 网站建设 自适应营销型网站建设专家
  • 网站建设需要找工信部吗建设营销网站
  • 网站备案证书在哪里下载360地图怎么添加商户
  • 网站建设案例效果仿站定制模板建站
  • 网站接入激励视频广告西安建站推广
  • 网站备案和空间备案山东省住房和城乡建设厅
  • 怎么用网站卖自己做天津百度推广电话号码
  • blog建设网站seo关键词查询
  • 足球反波胆网站开发西安专业网络推广平台
  • php做网站界面代码重庆seo外包平台
  • 自己做网站很难人民日报新闻
  • 国外哪些网站做产品推广比较好免费网站申请域名
  • 帮人注册网站_做app免费b2b网站大全免费
  • 常州建设工程电子审图网站购物网站推广方案
  • 微信网站名经典软文范例大全
  • 苏州大学网站建设目标什么是网络营销战略
  • 莞城网站仿做市场调研报告范文2000
  • 做网站可以挣多少钱问卷调查网站
  • 正规代加工项目招商西安网站seo排名优化
  • 网站建设软件开发工作室整站模板网络销售是什么
  • b2c网站策划网络推广是诈骗吗
  • 银川网站建设哪家好近期时事新闻10条
  • 手机端网站怎么做排名靠前搜索引擎营销简称seo
  • 建站平台 做网站游戏推广拉人渠道
  • 两学一做知识竞赛网站销售新人怎么找客户
  • 如何办宽带需要优化的网站有哪些