当光标改变时重新加载ListView动画

3

我有一个带有动画效果的ListView。当ListView第一次加载时,动画播放得非常好。但是,当我更改游标时,我想让动画重新播放。

<ListView
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:cacheColorHint="@android:color/transparent"
    android:divider="@drawable/gradienthorizontal"
    android:dividerHeight="1px"
    android:layoutAnimation="@anim/layout_cascade"
    android:listSelector="@drawable/selector" >
</ListView>

我在这里更改光标:
private void majCurseurListe(long id, boolean choixvente) {
    Cursor curseurPtVente = null;

    if (choixvente) {
        curseurPtVente = mDbHelper
                .listePtsVentes(DBhelper.TYPE_PTVENTE, id);
    } else {
        curseurPtVente = mDbHelper.listePtsVentes(DBhelper.TYPE_PTSERVICE,
                id);
    }

    // Android s'occupe du cycle de vie du curseur
    startManagingCursor(curseurPtVente);
    ((CursorAdapter) getListAdapter()).changeCursor(curseurPtVente);
}
1个回答

5

只需调用

listView.startLayoutAnimation();

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接