ListView 中使用SimpleAdapter      lv.setOnItemClickListener(new MyOnItemClickListener());再加上这样一个事件监听 为什么会没反应?listviewsimpleadapter

解决方案 »

  1.   

    这样谁能回答你?
    看看这篇文章,比较基础
    http://blog.csdn.net/fs1360472174/article/details/8822719
      

  2.   

    就是在给一个使用了SimpleAdapter适配器的ListView设置了一个监听器  
    lv.setOnItemClickListener(new MyOnItemClickListener());class MyOnItemClickListener implements OnItemClickListener{ public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
    long arg3) {
    System.out.println(arg0);
    System.out.println(arg1);
    System.out.println(arg2);
    System.out.println(arg3);

    }

    }但是不论你怎么点   都不会有反应的   控制台不会输出任何东西
      

  3.   

    没有   具体代码如下package com.niu.app;import java.util.HashMap;
    import java.util.Map;
    import java.util.Vector;import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.view.Window;
    import android.view.WindowManager;
    import android.widget.AdapterView;
    import android.widget.AdapterView.OnItemClickListener;
    import android.widget.Button;
    import android.widget.LinearLayout;
    import android.widget.ListView;
    import android.widget.SimpleAdapter;public class SimpleAdapterActivity extends Activity {

    class MyOnItemClickListener implements OnItemClickListener{ public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
    long arg3) {
    System.out.println(arg0);
    System.out.println(arg1);
    System.out.println(arg2);
    System.out.println(arg3);

    }

    } protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState); ListView lv = new ListView(this);

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.FLAG_FULLSCREEN); String[] names = { "小明", "小红", "小强", "小花", "小刚" };
    String[] dels = { "删除1", "删除2", "删除3", "删除4", "删除5" };
    String[] upds = { "修改1", "修改2", "修改3", "修改4", "修改5" }; Vector<Map<String, Object>> v = new Vector(); for (int i = 0; i < names.length; i++) {
    HashMap map = new HashMap();
    map.put("stuName", names[i]);
    map.put("dels", dels[i]);
    map.put("upds", upds[i]);
    v.add(map);
    } SimpleAdapter adapter = new SimpleAdapter(this, v,
    R.layout.simple_list_item, new String[] { "stuName", "dels",
    "upds" }, new int[] { R.id.text_names,
    R.id.button_dels, R.id.button_upds });
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(new MyOnItemClickListener()); LinearLayout line = new LinearLayout(this);
    line.setOrientation(LinearLayout.VERTICAL); Button b = new Button(this);
    b.setText("添加"); line.addView(b);
    line.addView(lv); this.setContentView(line); }
    }
      

  4.   

    这段代码是ListItem部分Click是正常工作的