更改软键盘的换行键实

首先在XML文件中加入以下,
<EditText  
     
    android:imeOptions="actionGo"//如设置成 android:imeOptions="actionSearch" 
	                             //android:imeActionLabel="搜索",则会变成搜索按钮  
    android:imeActionLabel="@string/app_name"  
    />  

然后在代码引用中实现监听方法即可,

EditText.setOnEditorActionListener(new OnEditorActionListener(){
			@Override
		public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
			if(actionId == EditorInfo.IME_ACTION_GO){

				Toast.makeText(this, "换行键已更改", Toast.LENGTH_SHORT).show();
			}
			return false;
		}
});


你可能感兴趣的:(更改软键盘的换行键实)