1,在主Listview Item XML中最顶层这里我用的是LinearLayout 设置android:descendantFocusability="blocksDescendants"
并设置主Listview android:focusable="false"
子ListView事件和button事件
//listview事件
viewHolder.listView.setOnItemClickListener(new listv_Goods()); private class listv_Goods implements OnItemClickListener{ @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub Map<String, String> item = (Map<String, String>) parent.getItemAtPosition(position); Toast.makeText(context, item.get("name"),Toast.LENGTH_LONG).show(); } }
button
viewHolder.btn_Track.setOnClickListener(new btnOnClick(position)); private class btnOnClick implements OnClickListener{ int position ; public btnOnClick(int pos) { position=pos; } @Override public void onClick(View v) { // TODO Auto-generated method stub if(v.getId()==R.id.btn_Track) { Toast.makeText(context, listMaps.get(position).get("orderId"),Toast.LENGTH_LONG).show(); } } }