相关疑难解决方法(0)

在webview中禁用滚动?

到目前为止,我只是一名iPhone开发人员,现在我决定给Android一个旋转.我在Android上无法弄清楚的是如何以编程方式阻止滚动WebView

类似于iPhone预防onTouchMove活动的东西会很棒!

android android-webview android-scrollbar android-scroll

81
推荐指数
6
解决办法
13万
查看次数

如何在Android中为WebView创建Scroll侦听器

如何WebView在Android中实现Scroll Listener

我试过这个,但它没有调用我Log.i滚动webview.

package com.example.webview.full.width;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.webkit.WebView;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;

public class scorllableWebview extends WebView implements OnScrollListener {


Context ctx;
AttributeSet atrs;

public scorllableWebview(Context context) {
    super(context);

    ctx = context;
}

public scorllableWebview(Context context, AttributeSet atters){
    super(context, atters);

    ctx = context;
    atrs = atters;
}

@Override
public void onScroll(AbsListView view, int firstVisibleItem,
        int visibleItemCount, int totalItemCount) {

    Log.i("onScroll", "Called");
}

@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {


    Log.i("onScrollStateChanged", …
Run Code Online (Sandbox Code Playgroud)

android custom-controls scrollview webview

43
推荐指数
4
解决办法
4万
查看次数

Android WebView 不可滚动

我的安卓WebView不能滚动。

XML 代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/screen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#87cefa"
android:gravity="left"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<WebView
    android:id="@+id/webView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_centerHorizontal="true" />
Run Code Online (Sandbox Code Playgroud)

我正在使用正常webview.loadUrl(url);功能加载网站,有时使用该webview.loadDataWithBaseURL("", htmlContent, "text/html", "UTF-8", "");功能加载网站,它们都显示页面,但它们不可滚动

在里面:

setContentView(R.layout.activity_main); webview = (WebView)this.findViewById(R.id.webView); webview.setVerticalScrollBarEnabled(true); webview.setHorizontalScrollBarEnabled(true);

加载:

            webview.loadUrl(url);
            [either one of them or the other]
    webview.loadDataWithBaseURL("", htmlContent, "text/html", "UTF-8", "");
Run Code Online (Sandbox Code Playgroud)

java android scroll webview

3
推荐指数
1
解决办法
2万
查看次数