我的应用程序有一个LinearLayout,LinearLayout由3个Linearlayouts组成,每个线性布局都有一个Relativelayout和一个线性布局(最初这些线性布局的可见性消失了).如果单击相对布局,则将显示相关的线性布局.但是如何在单击相对布局后刷新整个线性布局.
码:
private OnClickListener exit2Listener = new OnClickListener()
{
public void onClick(View v)
{
if(!exit2status)
{
if(RB_Constant.upcomingexits_obj.response.size() > 1)
{
if(RB_Constant.upcomingexits_obj.response.get(1).listRestaurants.size() > 0)
{
// Create the views on the fly instead of using the ListView
UpcomingResultsListViewAdapter2 rbupcadapter2 = new UpcomingResultsListViewAdapter2(RB_UpcomingExits.this);
int numItems2 = 0;
if(RB_Constant.upcomingexits_obj.response.get(1).listRestaurants.size() > 0)
{
numItems2 = RB_Constant.upcomingexits_obj.response.get(1).listRestaurants.size();
}
//linearLayout2
for(int position=0; position < numItems2; position++)
{
View convertview = null;
convertview = rbupcadapter2.getView(position,convertview,null);
listLayout2.addView(convertview);
}
}
}
else
{
//toastMsg("No results!");
}
listLayout2.setVisibility(View.VISIBLE);
exit2status=true;
if(!exit1status || exit3status || exit4status || exit5status)
{
//System.out.println("exit2 GONE");
listLayout1.setVisibility(View.GONE);
listLayout3.setVisibility(View.GONE);
exit1status = false;
exit3status = false;
}
LLExitDetails.invalidate();
}
else
{
System.out.println("exit2 GONE");
listLayout2.setVisibility(View.GONE);
exit2status = false;
LLExitDetails.invalidate();
}
}
};
最佳答案