Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/196.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何使ScrollView在我单击键盘上的向下键或向上键时不滚动?_Android_Keyboard_Scrollview_Onkeydown - Fatal编程技术网

Android 如何使ScrollView在我单击键盘上的向下键或向上键时不滚动?

Android 如何使ScrollView在我单击键盘上的向下键或向上键时不滚动?,android,keyboard,scrollview,onkeydown,Android,Keyboard,Scrollview,Onkeydown,即使我自定义了ScrollView和覆盖dispatchKeyEvent函数,它仍然会滚动。 我不希望它滚动,如果我点击键盘上的向下/向上键,但滚动时,我使用鼠标。有办法吗 public class UserDefinedScrollView extends ScrollView { private static final String LOG_TAG = "UserDefinedScrollView"; @Override public boolean dispatchKeyEvent(

即使我自定义了
ScrollView
和覆盖
dispatchKeyEvent
函数,它仍然会滚动。 我不希望它滚动,如果我点击键盘上的向下/向上键,但滚动时,我使用鼠标。有办法吗

public class UserDefinedScrollView extends ScrollView {

private static final String LOG_TAG = "UserDefinedScrollView";

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // TODO Auto-generated method stub
    //return super.dispatchKeyEvent(event);
    Log.i(LOG_TAG, "dispatchKeyEvent "+event.getKeyCode());
    return false;
}

public UserDefinedScrollView(Context context, AttributeSet attrs) {
    super(context, attrs);
    // TODO Auto-generated constructor stub
}

}

那样做是不合逻辑的。。为什么android用户会使用键盘在设备中滚动或使用鼠标?它在我们的设备上运行。不是平板电脑或手机。它使用红外遥控器。就像电视遥控器一样,我用setFocusable(false)来解决它;