码迷,mamicode.com
首页 > 其他好文 > 详细

遍历ListView,查出每一项的内容

时间:2014-07-15 23:03:17      阅读:308      评论:0      收藏:0      [点我收藏+]

标签:os   for   io   line   re   new   

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));
}
}
};

遍历ListView,查出每一项的内容,布布扣,bubuko.com

遍历ListView,查出每一项的内容

标签:os   for   io   line   re   new   

原文地址:http://www.cnblogs.com/zmc/p/3843823.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!