zoukankan      html  css  js  c++  java
  • 遍历ListView,查出每一项的内容

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

  • 相关阅读:
    TreeSet和TreeMap中“相等”元素可能并不相等
    求众数——摩尔投票
    5802. 统计好数字的数目
    快速幂
    LCP 07.传递消息
    332. 重新安排行程(欧拉回路问题)
    126. 单词接龙 II
    879. 盈利计划
    287. 寻找重复数
    239. 滑动窗口最大值
  • 原文地址:https://www.cnblogs.com/zmc/p/3843823.html
Copyright © 2011-2022 走看看