我对ListView
有一个问题:使用2 ListView
我希望当我点击一个时,另一个消失并且不会使它们重叠。我只想点击并打开第一个ListView
,然后在我点击打开第二个ListView
之前,第一个关闭。
我正在使用的代码是这个,也可以在下图中看到:
switch (v.getId()) {
case R.id.like:
preecheListLike();
listaLike.setVisibility(View.VISIBLE);
listaLike.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String nome = listaLike.getItemAtPosition(position).toString();
setMarker(latit, longi, nome, true, position);
listaLike.setVisibility(View.INVISIBLE);
setUpMap();
}
});
break;
case R.id.dislike:
preecheListDislike();
listaDislike.setVisibility(View.VISIBLE);
//listaLike.setVisibility(View.INVISIBLE);
listaDislike.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String nome = listaDislike.getItemAtPosition(position).toString();
setMarker(latit, longi, nome, false, position);
listaDislike.setVisibility(View.INVISIBLE);
setUpMap();
}
});
break;
case R.id.rota:
//AQUI ATIVA O BOTAO CALCULAR ROTA
//showDist.setVisibility(View.VISIBLE);
calcRout.setVisibility(View.VISIBLE);
yourDest.setVisibility(View.VISIBLE);
break;
}
}