简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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