在滚动视图 LinearLayout 中的 Edittext scrollView 中,有时 edittext 会引发异常,我不知道为什么会发生这种情况。任何人有想法请帮助我。感谢提前
这是我的代码:::
edittext.setOnTouchListener(new ScrollView.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
try {
int action = event.getAction();
Log.e("action:",action+"");
switch (action) {
case MotionEvent.ACTION_DOWN:
// Disallow ScrollView to intercept touch events.
float iniY = event.getRawY();
v.getParent().getParent().getParent()
.requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_UP:
// Allow ScrollView to intercept touch events.
v.getParent().getParent()
.requestDisallowInterceptTouchEvent(false);
break;
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.e("e", e.getMessage());
}
return false;
}
});
11-08 17:43:39.836:E/InputEventReceiver(10223):异常调度输入事件。11-08 17:43:39.836:E/MessageQueue-JNI(10223):MessageQueue 回调中的异常:handleReceiveCallback 11-08 17:43:39.851:E/MessageQueue-JNI(10223):java.lang.NullPointerException