当前位置:操作系统 > 安卓/Android >>

Android --- layoutAnimation应用

1.写一个left_in.xml方法


[html] 
<?xml version="1.0" encoding="utf-8"?> 
<translate xmlns:android="http://schemas.android.com/apk/res/android" 
    android:duration="300" 
    android:fillAfter="false" 
    android:fromXDelta="-550" 
    android:toXDelta="0" > 
</translate> 
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="300"
    android:fillAfter="false"
    android:fromXDelta="-550"
    android:toXDelta="0" >
</translate>

 

2.写一个layoutAnimation.xml方法


[html]
<?xml version="1.0" encoding="utf-8"?> 
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android" 
    android:animation="@anim/player_info_left_in" 
    android:animationOrder="normal" 
    android:delay="0.75" > 
 
</layoutAnimation> 
<?xml version="1.0" encoding="utf-8"?>
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
    android:animation="@anim/player_info_left_in"
    android:animationOrder="normal"
    android:delay="0.75" >

</layoutAnimation>


3.在一个拥有多行子控件的View中加载,如:


[html]
<?xml version="1.0" encoding="windows-1250"?> 
<TableLayout 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:layoutAnimation="@anim/left_in_player_info_show_anim" > 
        <TableRow ........./> 
        <TableRow ........./> 
        <TableRow ........./> 
        <TableRow ........./> 
        <TableRow ........./> 
</TableLayout> 
<?xml version="1.0" encoding="windows-1250"?>
<TableLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layoutAnimation="@anim/left_in_player_info_show_anim" >
       <TableRow ........./>
        <TableRow ........./>
        <TableRow ........./>
        <TableRow ........./>
        <TableRow ........./>
</TableLayout>
4.这样就能在打开上面xml页面时,逐行的按<TableRow />加载动画效果.

 


PS:Android提供的非常不错的功能.比使用Su易做图ceView实现要简单的多....

 作者:bys0201
 


 

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,