Hai dude, 我开发了一个应用程序,它最初显示了游戏列表视图,假设用户点击该游戏列表视图中的足球元素,那么足球列表视图打开,如果用户选择了特定的玩家列表视图,那么它显示,我的问题是我想要2知道哪个列表视图处于活动状态。
任何人都可以帮我解决这个问题吗?
if(tabHost.getCurrentTab() == 2)
{
Log.v("I m Here Boss","0");
if(findViewById(R.id.bars_school_details).getVisibility() == View.VISIBLE)
{
Log.v("I m Here Boss","1");
findViewById(R.id.bars_school_details).setVisibility(View.GONE);
findViewById(R.id.bars_list).setVisibility(View.GONE);
findViewById(R.id.bars).setVisibility(View.VISIBLE);
}
else if(findViewById(R.id.bars_list).getVisibility() == View.VISIBLE)
{
Log.v("I m Here Boss","2");
findViewById(R.id.bars_school_details).setVisibility(View.VISIBLE);
findViewById(R.id.bars_list).setVisibility(View.GONE);
findViewById(R.id.bars).setVisibility(View.GONE);
}
}
答案 0 :(得分:0)
最后我得到了解决方案,我将代码更改为
try {
if(tabHost.getCurrentTab() == 2)
{
try{
if(BS_.lv_bardate.getVisibility() == View.VISIBLE)
{
BS_Bars.lv_bardate.setVisibility(View.GONE);
BS_Bars.lv_barlist.setVisibility(View.GONE);
BS_Main.tv.setText("Schools");
BS_Bars.lv.setVisibility(View.VISIBLE);
}
if(BS_Bars.lv_barlist.getVisibility() == View.VISIBLE)
{
BS_Bars.lv_bardate.setVisibility(View.VISIBLE);
BS_Main.tv.setText("Dates");
BS_Bars.lv_barlist.setVisibility(View.GONE);
BS_Bars.lv.setVisibility(View.GONE);
}
if(BS_Bars.sv.getVisibility() == View.VISIBLE)
{
BS_Bars.lv_bardate.setVisibility(View.GONE);
BS_Bars.lv_barlist.setVisibility(View.VISIBLE);
BS_Bars.lv.setVisibility(View.GONE);
}
if(BS_Bars.lv.getVisibility() == View.VISIBLE)
{
// BS_Bars.lv_bardate.setVisibility(View.GONE);
// BS_Bars.lv_barlist.setVisibility(View.GONE);
// BS_Bars.lv.setVisibility(View.GONE);
finish();
}
}
catch(Exception e)
{
Log.v("BSMain","Error in Bar Module Back Button");
}
}