您的位置:首页 > 移动开发

android-实现WebView只能滚动不能点击

2016-08-15 17:28 330 查看
转载自mjjmjc

实现WebView只能上下滚动不能对内容进行点击(enable scroll and disable click),主要有两个步骤:

1、添加ScrollView

2、禁止WebView的点击事件传递

一、主要布局编写

<ScrollView
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<WebView
android:id="@+id/webView"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</ScrollView>


二、禁止WebView点击

webView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android webview