My EditText in xml wrapped in LinearLayout:
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="TYPE HERE"
android:padding="7dp"
android:singleLine="true"
android:cursorVisible="true"
android:textIsSelectable="true"
/>
And in my fragment:
mEditText.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
mEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mEditText, InputMethodManager.SHOW_IMPLICIT);
return true;
}
Copy and paste feature doesn't work on the edit text ?? When I comment onTouchListener it works !
acbacbeaoclacm m cl adc a dcl arc ac a c amid ncoeocnejnlwencnajlendjlcejbcbaclbaldcblabdlbclabdclbladbclaelbclabdbcalebecam emac cjaecljabecbaebcjbec
From the source (http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.1.1_r1/android/widget/TextView.java) it seems that onTouch
events are handling the IME, keyboard, copy/paste, and similar operations. If you override those methods or provide custom listeners, make sure you handle the events yourself.