private ListView.OnItemClickListener showItemDetail = new ListView.OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
//全选遍历ListView的选项,设置所有的layDetail不可见
for(int i = 0; i < lvList.getChildCount(); i++)
{
View viewChild = lvList.getChildAt(i);
LinearLayout layMain = (LinearLayout)viewChild.findViewById(R.id.layMain);
LinearLayout layDetail = (LinearLayout)viewChild.findViewById(R.id.layDetail);
layMain.setBackgroundDrawable(getResources().getDrawable(R.drawable.mm_listitem));
layDetail.setVisibility(View.GONE);
}

LinearLayout layMain = (LinearLayout)view.findViewById(R.id.layMain);
LinearLayout layDetail = (LinearLayout)view.findViewById(R.id.layDetail);

if (layDetail.getVisibility() == View.VISIBLE)
{
layDetail.setVisibility(View.GONE);
layMain.setBackgroundDrawable(getResources().getDrawable(R.drawable.mm_listitem));
}
else
{
layDetail.setVisibility(View.VISIBLE);
layMain.setBackgroundDrawable(getResources().getDrawable(R.drawable.mm_listitem_pressed));
}
}
};

相关文章:

  • 2021-11-15
  • 2022-12-23
  • 2022-02-14
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2021-09-18
猜你喜欢
  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案