我知道如何使用bindView在listview上设置颜色。所以,当它创建时,(或滚动到屏幕上)颜色设置...更改按钮上的listview背景颜色按
但是,我如何通过现有的意见,而不破坏和重新创建整个事情。
阿卡,如果我按一个按钮,我想强调的是在光标第二场屏幕项目(列表视图)的所有现有= False
Item 1, True
Item 2, True
Item 3, False -- Should highlight Green on button press.
Item 4, True
编辑:
目前我这样做,但它需要刷新游标。
int currentPosition = lv.getFirstVisiblePosition(); // Obtain where list is
lv.setAdapter(null);
Cursor cursor = SqlDB.getCursor();
adap = new MyAdaptor(this, R.layout.list, cursor, columns, to, true, 0);
lv.setAdapter(adap);
lv.setSelection(currentPosition); // Move back to where it was
您使用的是自定义适配器吗? –
@ShivamVerma是的,它扩展了'SimpleCursorAdapter',但只是一个自定义布局。 – Mcloving