开发者

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?

开发者_开发技巧

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜