Android – animating new items in tableview

I am using tableview to display the contents of SQLite database. The user clicks one of the checkable buttons, and the right table is read through the localstorage API. Therefore, the model is always new

Because the model is always new, the loading of new tables is not visually attractive (all entries are displayed at once)

My idea is to animate the height of the row when adding rows (starting from 0 and in a linear manner)

Can this be done without re implementing rowdelegate from scratch?

resolvent:

Yes, it is possible

Tableview uses listview as the internal object. You can use properties__ Listview accesses it

Using listview, you can specify the transition that should be applied when the items in the view change due to modifying the view model

Transition {
    id: populateTransition
    NumberAnimation { properties: "y"; duration: 300 }
}

TableView {
    TableViewColumn {
        role: "title"
        title: "Title"
        width: 100
    }
    model: libraryModel
    Component.onCompleted: {
        this.__listView.populate = populateTransition
        this.__listView.add = populateTransition
    }
}

Attachment: this solution relies on modifying internal objects and does not guarantee that it can work across different QT versions or platforms

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>