简体   繁体   English

Android EditText链接到按钮

[英]Android EditText Link to Button

Not sure how this should be implemented. 不确定应如何实施。 I have an activity with an Edit Text and Button (a text field to specify search parameters, and a button to execute the search). 我有一个带有“编辑文本”和“按钮”(用于指定搜索参数的文本字段,以及用于执行搜索的按钮)的活动。 Right now the user has to enter text in the field and then press the Search button. 现在,用户必须在字段中输入文本,然后按“搜索”按钮。 How can I make that button the default action, or someone configure the edit text field to click that button when the user presses enter? 如何使该按钮成为默认操作,或者当用户按下Enter键时,有人将编辑文本字段配置为单击该按钮?

Currently with the default behavior, when I select that edit text field, there is no return key shown on the virtual keyboard. 当前具有默认行为,当我选择该编辑文本字段时,虚拟键盘上没有显示返回键。

Any ideas? 有任何想法吗?

Found the documentation item for this shortly after posting the question. 发布问题后不久找到了有关此文档的内容。

 <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"/>

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM