cursor won't change in edittext

时间:2015-10-31 00:02:17

标签: java android user-interface android-edittext

So I have an EditText, (two actually, but both have the same problem,) and I added an OnTouchListener. I need to know what EditText I'm working with for another method. The problem is, before adding the listener, if I clicked somewhere in the EditText, the cursor would update. Now the cursor won't update at all. editText.setOnTouchListener(new View.OnTouchListener() { @SuppressWarnings("UnusedAssignment") @Override public boolean onTouch(View v, MotionEvent event) { EditText et = (EditText) v; et.requestFocus(); return true; } });

1 个答案:

答案 0 :(得分:0)

在这种情况下,最好在public class PermissionResponseReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, Intent intent) { ...... } } 中返回false。这是因为return value specifies whether or not the listener consumes the event.返回false应该允许窗口小部件以其正常行为响应触摸事件,除了您指定的任何其他内容。