1:
more info
2:
在adapter里,有getView,可以对position的item进行操作。

解决方案 »

  1.   

    能不能具体点,我是菜鸟。
    我的代码:
    ScoreInformation.javapublic class ScoreInformation extends Activity {
       private ListView lv;
    /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            
            ArrayList<HashMap<String,String>> mylist = new ArrayList<HashMap<String,String>>();
         HashMap<String,String> map = new HashMap<String,String>();
            map.put("ID", "学号");
            map.put("Name", "姓名");
            map.put("Course", "科目");
            map.put("Score", "成绩");
            mylist.add(map);
            for(int i=0; i<Datainfo.studentLength; i++){
             int j=0;
             HashMap<String,String> map1 = new HashMap<String,String>();
                map1.put("ID",Datainfo.data[j++][i]);
                map1.put("Name", Datainfo.data[j++][i]);
                map1.put("Course", Teacherinfo.course);
                if(Datainfo.data[j++][i].equals("null")){
                 map1.put("Score", "");
                }else{
                map1.put("Score", Datainfo.data[j++][i]);
                }
                mylist.add(map1);
            }        SpecialAdapter adapter = new SpecialAdapter(this, mylist, R.layout.scoreinformation, 
             new String[]{ "ID","Name","Course","Score"}, 
             new int[] { R.id.tv1,R.id.tv2,R.id.tv3,R.id.tv4}
            );
        
            lv = new ListView(this);
            lv.setHorizontalScrollBarEnabled(true);
            lv.setAdapter(adapter);
            HorizontalScrollView hsv = new HorizontalScrollView(this);
            hsv.addView(lv);
            setContentView(hsv);
        }
    }
    其中“tv4”是记录分数的EditTextSpecialAdapter.java
    public class SpecialAdapter extends SimpleAdapter {
    private int[] colors = new int[]{
    0x30FF0000, 0x300000FF 
    };
    public SpecialAdapter(Context context, List<? extends Map<String, ?>> data,
    int resource, String[] from, int[] to) {
    super(context, data, resource, from, to);
    // TODO Auto-generated constructor stub
    } @Override
    public View getView(int position, View convertView, ViewGroup parent) {
    View view = super.getView(position, convertView, parent);
    int colorPos = position % colors.length;
    if(colorPos==1){
    view.setBackgroundColor(Color.argb(250, 255, 255, 255));
    }else{
    view.setBackgroundColor(Color.argb(250, 224, 243, 250));
    }
    return view;
    }
    }
      

  2.   

    public View getView(int position, View convertView, ViewGroup parent) {
    ------------------------------------------------------------------------
    在这里加listener之类 在listener里处理
      

  3.   

    在public View getView(int position, View convertView, ViewGroup parent)这个里面添加对EditText的修改函数,这样就能够获得哪个被修改,修改的内容是什么了
      

  4.   

    创建一个EditText的二位数组 然后用for循环动态布局 这时为每一个数组成员 setTag(key, value); 可以设置每一项的相关信息,然后监听 就可以
      

  5.   

    2、 你一定是对listview进行事件监听了吧、 这是呢,就会有一个参数代表 了你对哪个item进行了点击,这个参数就是你想要的position哦 
      

  6.   


    谢谢你的提醒  我试了一下OnItemClickListener 但是他居然没有调用   这是什么情况?
      

  7.   

       这个......我用的是循环动态布局  但是循环的是整个ListView  所有的EditText都用的“tv4”这个id
      

  8.   

    那就不用ListView 我现在就在做这块 一堆表格 恶心死了 我就没用ListView 动态布局 后台让我怎么画表格我就怎么画 然后手动添加 滚动条之类的 
      

  9.   

    给你看一段代码 大概就这个意思for(int j = 0; j < colcount;j++){
    et[i][j] = new EditText(c);
    et[i][j].setTag(R.string.flag, null);
    et[i][j].setTag(R.string.colsname, s.params.get(j).col);

    et[i][j].setTag(R.string.max, s.params.get(j).max);
    et[i][j].setTag(R.string.min, s.params.get(j).min);
    et[i][j].setTag(R.string.pcs, s.params.get(j).pcs);
    et[i][j].setTag(R.string.tpy, s.params.get(j).tpy);

    et[i][j].setTag(R.string.id, id);
    et[i][j].setTextSize(Devicer.getFontNormal());

    if (j == colcount-1 && flag){
    et[i][j].setTag(R.string.max, String.valueOf(Integer.MAX_VALUE));
    }

    layout.addView(et[i][j], width/(colcount+1)+20, Devicer.getTextViewHeight());

    if (s.params.get(j).tpy.equals("N")){
    et[i][j].setInputType(InputType.TYPE_CLASS_NUMBER);
    et[i][j].setText("0");
    if(Integer.valueOf(s.params.get(j).pcs) > 0){
    et[i][j].setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    }
    }

    if (s.params.get(j).tpy.equals("L")){
    et[i][j].setEnabled(true);
    et[i][j].setText("0");
    et[i][j].setInputType(InputType.TYPE_NULL);
    et[i][j].setEnabled(false);
    et[i][j].setClickable(false);

    } DTextWatcher watcher = new DTextWatcher(et[i][j], handler);
    et[i][j].addTextChangedListener(watcher);
    et[i][j].setImeOptions(EditorInfo.IME_ACTION_UNSPECIFIED);

    et[i][j].setOnFocusChangeListener(new OnFocusChangeListener() {
    public void onFocusChange(View view, boolean hasChange){ 

    if (view.getTag(R.string.tpy).equals("L")){
    view.setClickable(false);
    return;
    } }
    }
    });
    }
      

  10.   

    弱弱的问下  你的EditText的二位数组是怎么申请的?我怎么老是空指针啊?
      

  11.   


    //声明
    public EditText [][] et = null;//申请
    et = new EditText[rowcount][colcount];//为每一项申请
    for(int j = 0; j < colcount;j++){
                et[i][j] = new EditText(c);
    }
      

  12.   

    我试验了一下  listview里出现button edittext等可点击控件后 listview的OnItemClickListener事件就不起作用了 不知道是这样吗?
      

  13.   

    关于第二个问题 基本上解决了  就是动态申请EditText数组  每一个设置Listener
    第一个问题大家有建议没?
    关于这个问题的阐述:
    点击edittext后会出现软键盘 然后正常情况下 点击返回键  应该是软键盘消失  edittext中出现你刚填写的字符  但是实际情况是  点击完后 edittext内容为空了
      

  14.   

    不应该啊 ,你别点返回,点软键盘上面的完成键呢?我没遇到过这种情况,难道你用了TextWatcher?对输入进行监听了?
      

  15.   

    话说 今天碰到了跟楼主一样的问题,后来竟然给解决了,把代码发上来,希望对以后的人有帮助
    主要思路是  自定义一个适配器,在适配器中找到editText,对editText增加一个检测文字改变事件。事件里面会有修改前,修改时,修改后的各种参数,找到想要的保存下来就好了。
    上面各位大大已经讲得差不多了,代码也只是简略代码,希望能给大家启发class mylistphone{
    private TextView tv;
    private EditText ed;

    }
    class myAdapter extends BaseAdapter{
    private Context ctx;
    private ArrayList al ;
    private String myend;
    private LayoutInflater in;
    public myAdapter(Context ctx , ArrayList al ){
    this.ctx = ctx;
    this.al = al;
    }
    public int getCount() {
    return al.size();
    } @Override
    public Object getItem(int position) {
    return al.get(position);
    } @Override
    public long getItemId(int position) {
    return position;
    } @Override
    public View getView(int position, View view, ViewGroup parent) {
    // String after="";
    // final StringBuffer sb = new StringBuffer();
    mylistphone mylist = new mylistphone();
    in = LayoutInflater.from(ctx);
    View v = in.inflate(R.layout.lvphone, null);
    mylist.tv = (TextView) v.findViewById(R.id.tvlvphonetype);
    mylist.ed  = (EditText)v.findViewById(R.id.edlvphonenumber);
    mylist.tv.setText(((HashMap)al.get(position)).get("type").toString());
    String be = ((HashMap)al.get(position)).get("phonenumber").toString();
    mylist.ed.setText(((HashMap)al.get(position)).get("phonenumber").toString());
    mylist.ed.addTextChangedListener(new TextWatcher() {
    public void onTextChanged(CharSequence s, int start, int before, int count) {
    // System.out.println("s:"+s+",start:"+start+",before:"+before+",count:"+count);
    }
    public void beforeTextChanged(CharSequence s, int start, int count,
    int after) {
    // System.out.println("s:"+s+",start:"+start+",after:"+after+",count:"+count);
    }
    public void afterTextChanged(Editable s) {
    // System.out.println(s.toString());
    // sb.append(s.toString());
    myend = s.toString();
    }
    });

    if(be.equals(myend)|| myend==null || myend==""){
    // mylist.ed.setText(myend);
    myend="";
    }else{
    // System.out.println(myend+",ttttttttttttttttt");
    mylist.ed.setText(myend);
    myend="";
    }

    return v;
    }

    }
      

  16.   

    @jj5124 
    我试了你说的方法,还是没有解决 EditText 编辑完毕后,点击返回键后内容消失。
    楼主,你的第一个问题解决了没?
      

  17.   

    碰见和楼主 差不多的问题 ListView 中的EditText  无法输入 获取不到焦点  怎么办?