如何通过listtext中的edittext编辑listview中的textview值?

时间:2014-02-26 11:13:08

标签: android-listview

这是我的代码。我在listview中有一个textview和edittext,任何人都可以帮我这个吗?提前谢谢....

final ListAdapter adapter = new SimpleAdapter(Viewer.this, viewnotes,
            R.layout.note_list, new String[] { "Id", "Notes", "Notes" },
            new int[] { R.id.noteid, R.id.listnote2, R.id.listnote });
    listnote.setAdapter(adapter);
    listnote.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view,
                  int position, long id) {
                  EditText textnote = (EditText) view.findViewById(R.id.listnote2);  
                  notename1 = (TextView) findViewById(R.id.listnote);
                  textnote.setVisibility(View.VISIBLE);
                  notename1.setVisibility(View.GONE);


              }
            });

}

1 个答案:

答案 0 :(得分:0)

处理完成的软键或输入如下并刷新列表

editText.setOnEditorActionListener(new TextView.OnEditorActionListener(){
    public boolean onEditorAction(TextView exampleView, int actionId, KeyEvent event){
        if(actionId == EditorInfo.IME_ACTION_DONE 
            || actionId == EditorInfo.IME_NULL
            || event.getKeyCode() == KeyEvent.KEYCODE_ENTER){

            //Do something in here
            return true;
        } else {
            return false;
        }
    }
});