Android的HorizontalScrollView禁用滚动 [英] Android HorizontalScrollView disable scrolling
本文介绍了Android的HorizontalScrollView禁用滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我HorizontalScrollView以长远的眼光作为一个孩子,所以HorizontalScrollView是滚动的,可以水平滚动的孩子。
是否有可能阻止吗?我不希望用户能够滚动视图
I have HorizontalScrollView with long view as a child, so HorizontalScrollView is scrollable and can scroll its child horizontally. Is there any possibility to block that? I don't want user to be able to scroll the view.
推荐答案
我的建议是使用 OnTouchListener ,例如:
My suggestion is to use an OnTouchListener, for example:
在的onCreate
方法
HorziontalScrollView scrollView= (HorizontalScrollView)findViewById(R.id.scrollView);
scrollView.setOnTouchListener(new OnTouch());
和有一个类:
And has a class:
private class OnTouch implements OnTouchListener
{
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
}
这篇关于Android的HorizontalScrollView禁用滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文