2012-11-14 84 views

回答

0

刪除機器人:可調焦的屬性,機器人:XML文件在foucsableInTouchMode屬性和標籤,從現在做起,然後

public class YOURMAINActivity extends Activity implements OnClickListener { 

    private EditText editTxt1; 
    private EditText editTxt2; 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.layout_id); 
     editTxt1 = (EditText)findViewById(R.id.edit_text_one_id); 
     editTxt2 = (EditText)findViewById(R.id.edit_text_two_id); 
     editTxt1.setOnClickListener(this); 
     editTxt2.setOnClickListener(this); 

    @Override 
    public void onClick(View view) { 

     switch(v.getId()) { 

      case R.id.R.id.edit_text_one_id : 
        editTxt1.requestFocus(); 
        editTxt1.setFocusable(true); 
        editTxt2.setFocusable(false); 
        break; 
      case R.id.R.id.edit_text_two_id : 
        editTxt2.requestFocus(); 
        editTxt2.setFocusable(true); 
        editTxt1.setFocusable(false); 
        break; 
     } 
     // Add Code for Showing Keyboard Here 
    } 
} 
相關問題