布局动画控制器教程
fusionapp吧
全部回复
仅看楼主
level 5
#fusionapp#
#布局动画控制器#

--fusionapp布局动画控制器教程
--为了方便学习理解,我会用中文变量进行命名,但真正的项目中不推荐用中文哦
--首先创建一个布局进行动画测试
shamrock=--创建一个布局表并将其赋给变量shamrock
{
LinearLayout;--线性布局
Orientation='vertical';--布局方向
layout_width='fill';--布局宽度
layout_height='fill';--布局高度
background='';--布局背景颜色(或者图片路径)
{
ListView;--列表视图
id='list';--绑定id
layout_width='fill';--布局宽度
layout_height='fill';--布局高度
--dividerHeight='';--设置分隔线宽度,0表示无分隔线
background='';--布局背景颜色(或者图片路径)
};
};
activity.setContentView(loadlayout(shamrock))--将布局表添加至窗口
--使用适配器为list添加列表
数据={}
--添加项目数组
for i=1,10 do
table.insert(数据,tostring(i))
end
--创建适配器
array_adp=ArrayAdapter(activity,android.R.layout.simple_list_item_1,String(数据))
--设置适配器
list.setAdapter(array_adp)
--LayoutAnimationController可以控制一组控件按照规定显示
--导入类
import "android.view.animation.AnimationUtils"
import "android.view.animation.LayoutAnimationController"
--创建一个Animation对象
animation = AnimationUtils.loadAnimation(activity,android.R.anim.slide_in_left)
--得到对象
lac = LayoutAnimationController(animation)
--设置控件显示的顺序
lac.setOrder(LayoutAnimationController.ORDER_NORMAL)
--LayoutAnimationController.ORDER_NORMAL 顺序显示
--LayoutAnimationController.ORDER_REVERSE 反显示
--LayoutAnimationController.ORDER_RANDOM 随机显示
--设置控件显示间隔时间
lac.setDelay(1)--这里单位是秒
--设置组件应用
list.setLayoutAnimation(lac)
效果:
2020年06月14日 01点06分 1
level 7
没想到你是五年级小学生,I too.
2020年07月05日 04点07分 5
真的
2020年07月10日 11点07分
Yes
2020年07月14日 13点07分
level 5
真的吗?
2020年07月10日 11点07分 6
现在在学html
2020年07月14日 13点07分
level 5
????
2020年07月10日 11点07分 7
level 5
侧滑栏添加不了图片怎么办?可以教下吗?是不是少什么软件
2020年07月10日 17点07分 8
你没有图库吗?
2020年07月12日 06点07分
@晴天超爱下雨 不 是软件的问题 已经解决了
2020年07月31日 03点07分
1