2011-02-09 84 views
0

不知道这应该如何实现。我有一个使用编辑文本和按钮(指定搜索参数的文本字段,以及执行搜索的按钮)的活动。现在,用户必须在字段中输入文本,然后按搜索按钮。如何使该按钮成为默认操作,或者有人配置编辑文本字段以在用户按下Enter键时单击该按钮?Android EditText链接到按钮

当前使用默认行为,当我选择该编辑文本字段时,虚拟键盘上没有显示返回键。

任何想法?

回答

1

在发布问题后立即找到文档项目。

<EditText android:id="@+id/edtInput" 
     android:layout_width="0dip" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine" 
     android:imeOptions="actionSend|flagNoEnterAction" 
     android:maxLines="4" 
     android:maxLength="2000" 
     android:hint="@string/compose_hint"/> 

http://developer.android.com/resources/articles/on-screen-inputs.html