gpt4 book ai didi

android - SimpleCursorAdapter - 绑定(bind)到 ListView 中的多个项目值

转载 作者:太空狗 更新时间:2023-10-29 12:58:52 24 4
gpt4 key购买 nike

我有以下代码来实例化 SimpleCursorAdapter 以与 ListView 一起使用。如您所见,我已经传递了 R.layout.log_item 来显示列表项,并传递了一个值/控件来绑定(bind)到 (TripDate)。

SimpleCursorAdapter sca = new SimpleCursorAdapter(this, R.layout.log_item,c,new String[] {DBAdapter.KEY_LOG_TRIPDATE},new int[]{R.id.txtTripDate});

这行得通

我目前在布局 xml 中只有一个小部件,一个用于保存 TripDate 的 TextView。如何为布局中的其他小部件传递多个绑定(bind)参数?这样我还可以显示其他信息。

谢谢帕特里克

最佳答案

SimpleCursorAdapter sca = new SimpleCursorAdapter(this, R.layout.log_item,c,new String[] {DBAdapter.KEY_LOG_TRIPDATE, DBAdapter.KEY_FOO, DBAdapter.KEY_BAR},new int[]{R.id.txtTripDate, R.id.otherid1, R.id.otherid2});

关于android - SimpleCursorAdapter - 绑定(bind)到 ListView 中的多个项目值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2052955/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com