给listview设置默认选中:
listListview.post(new Runnable() {
@Override
public void run() {
//在这里面做初始化操作,下面的代码是操作index为0的item,设置他的背景颜色
listListview.getChildAt(0).setBackgroundResource(R.color.white);
}
注意:不能使用
lv_left.setSelection(0);
没有作用,也不能直接在setAdapter之后使用上面的代码,因为setAdapter属于异步操作.