xml配置:
android:id="@+id/sc_freement"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/category_line"
android:scrollbars="none"
android:fadingEdge="none">
</<span style="line-height: 21px; ">ScrollView>
java代码控制:
ScrollView scrollView = (ScrollView)this.findViewById(R.id.sc_freement);
scrollView.setOnTouchListener(new View.OnTouchListener(){
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
return true;
}
});
本文介绍如何通过XML配置和Java代码来禁用Android中ScrollView的滚动功能。XML配置部分展示了具体的属性设置,包括去除滚动条和淡入效果;Java代码部分则通过设置OnTouchListener并返回true来阻止触摸事件传播,从而实现禁止滚动。
3162

被折叠的 条评论
为什么被折叠?



