Listview 点击获取view

listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {

ViewGroup vg = (ViewGroup) listview;
int count = vg.getChildCount();
Log.v("position",String.valueOf(position));
for (int i = 0; i < count; i++) {

View v1 = vg.getChildAt(i);
LinearLayout llyout = (LinearLayout)v1.findViewById(R.id.linearLayout2);
if(i==position)
{

llyout.setVisibility(View.VISIBLE);

GridView gvson = (GridView)v1.findViewById(R.id.gdv_son);

}else{

llyout.setVisibility(View.GONE);
}

}
}
});

posted @ 2014-06-30 14:41  文艺流浪汉  阅读(374)  评论(0编辑  收藏  举报