2012-09-08 50 views
0

伙计们我做了一个自定义列表视图,列表视图有三个文本字段。当用户从刚刚填充文本视图的活动中按下后退按钮时,我想要继续工作,然后返回到包含定制列表视图的活动。最近刚刚进入的项目已经出现在那里。我想进入,从右侧的每用户进入到列表时刷卡查看activity.here的列表视图XML代码:为什么我的ListView没有得到动画?


<LinearLayout 
    android:id="@+id/listHolder" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="center" 
    android:background="#ffffff" > 

    <ListView 
     android:id="@+id/mylist" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 
    </ListView> 
    </LinearLayout> 

这里列表视图实际上是不利用完整空间为100dp的屏幕尺寸由其他一些小部件拍摄(但这并不重要)。我现在用的动画是这样的:


<?xml version="1.0" encoding="utf-8"?> 
    <set xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shareInterpolator="false" > 

    <scale 
    android:duration="1500" 
    android:fillAfter="false" 
    android:fromXScale="480dp" 
    android:fromYScale="0dp" 
    android:interpolator="@android:anim/overshoot_interpolator" 
    android:pivotX="60" 
    android:pivotY="10" 
    android:toXScale="100dp" 
    android:toYScale="0dp" /> 

    </set> 

什么是错的aniamtion XML?我是否为x和y值设置了错误的参数? 我得到的是,列表视图是在用户转到该活动后的第二秒或更晚的时间。我的意思是没有从右向左的过渡。任何想法为什么发生这种情况。谢谢。

回答

1

ü甚至还没有应用于乌尔动画的ListView那么如何ü可以显示动画] 和u应该把%pivotYpivotX 使用此代码:

保存为layout_controller.xmlanim文件夹中。

<?xml version="1.0" encoding="utf-8"?> 
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android" 
android:animation="@anim/rotation" 
android:animationOrder="normal" 
android:delay="10%" /> 

保存为rotation.xml在anim文件夹

<?xml version="1.0" encoding="utf-8"?> 
<rotate xmlns:android="http://schemas.android.com/apk/res/android" 
android:duration="500" 
android:fromDegrees="0.0" 
android:interpolator="@android:anim/accelerate_interpolator" 
android:pivotX="50%" 
android:pivotY="50%" 
android:toDegrees="360" /> 

现在把这个代码在YOUT ListView控件布局文件:

<LinearLayout 
android:id="@+id/listHolder" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:layout_gravity="center" 
android:background="#ffffff" > 

<ListView 
    android:id="@+id/mylist" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layoutAnimation="@anim/list_layout_controller" > 
</ListView> 
</LinearLayout> 

我的意思是我已经在你的布局中添加这一行现在你可以看到它的作品..

android:layoutAnimation="@anim/list_layout_controller" 
+0

谢谢凯拉什它完全工作。感谢您的帮助。 – Sam

+0

欢迎您@Sam –

相关问题