txtSearch
.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
text_search = txtSearch.getText().toString();
searchSong();
}
return false;
}
});
<EditText
android:id="@id/txt_search"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#00000000"
android:ems="10"
android:hint="@string/query_hint"
android:imeActionLabel="Search"
android:imeOptions="actionSearch"
android:inputType="text"
android:editable="true"
android:paddingLeft="30dp"
android:singleLine="true"
android:textColor="@color/hintsearch"
android:textColorHint="@color/hintsearch"
android:textSize="15sp" >
</EditText>
我使用默认键盘工作。但我测试其他键盘它不起作用。 我使用了软键盘:https://play.google.com/store/apps/details?id=com.vng.inputmethod.labankey