1
我打算給佈局動畫項目的ListView,我之前使用了android:layoutAnimation
。Android:如何編寫layoutAnimation而不是xml
<LinearLayout
...
android:layoutAnimation="@anim/layout_anim" />
// ../res/anim
<layoutAnimation
xmlns:android="http://schemas.android.com/apk/res/android"
android:animation="@anim/slide_up" />
我試着在適配器中給出以下代碼。
public View getView(int position, View convertView, ViewGroup parent) {
...
Animation animation = AnimationUtils.loadAnimation(context, R.anim.slide_up);
v.startAnimation(animation);
return v;
}
它可以工作,但slide_up
動畫是通過完整活動的級別實現的,而不是項目級別。它從活動的底部出現。最初它應該從項目的底部出現。
我錯了什麼?