Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8881073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:16:28+00:00 2026-06-14T20:16:28+00:00

I have a WebView in Android (4.2) which loads a local html with javascript

  • 0

I have a WebView in Android (4.2) which loads a local html with javascript (placed in the assets folder).

My Problem is, I can’t scroll in my WebView whatsoever. I Tried a lot of things and suggestions by similiar SO questions but nothing worked.

My Html is just a simple div-Tag which is used by the Kinetic-js framework to draw a picture and some canvas on top of it.

XML Layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="@dimen/text_size_smed_16sp"
            android:textColor="@android:color/white"
            android:text="@string/ui_floor_plan_building_textView" />

        <Spinner android:id="@+id/floor_plan_building_spinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <TextView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="@dimen/text_size_smed_16sp"
            android:textColor="@android:color/white"
            android:text="@string/ui_floor_plan_level_textView" />

        <Spinner android:id="@+id/floor_plan_level_spinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

        <AutoCompleteTextView android:id="@+id/floor_plan_room_autoTextView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:completionThreshold="1"
            android:hint="@string/ui_floor_plan_autocomplete_hint"
            android:inputType="number"
            android:imeOptions="actionSearch" />

    </LinearLayout>

     <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <WebView android:id="@+id/floor_plan_webView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />

     </LinearLayout>

</LinearLayout>

Java onCreate:

    this.webView = (WebView) findViewById(R.id.floor_plan_webView);
    this.webView.getSettings().setJavaScriptEnabled(true);

    this.webView.getSettings().setLoadWithOverviewMode(true);
    this.webView.getSettings().setUseWideViewPort(true);

    this.webView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
    this.webView.setScrollbarFadingEnabled(false);
    this.webView.setVerticalScrollBarEnabled(true);
    this.webView.setHorizontalScrollBarEnabled(true);

    this.webView.getSettings().setSupportZoom(true);
    this.webView.getSettings().setLightTouchEnabled(true);

    this.webView.setWebViewClient(new WebViewClient(){

        private boolean initialLoad = true;

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            if(this.initialLoad){
                this.initialLoad = false;
                drawFloorPlan();
            }
        }

    });
    this.webView.loadUrl(PATH_FLOOR_PLAN_HTML);

HTML file:

    <html>
        <head>
        <title>Floor Plans</title>

        <meta charset="UTF-8">

        <script type="text/javascript" src="floor_plan.js"></script>
        <script type="text/javascript" src="kinetic-v4.0.5.js"></script>
    </head>

    <body onload="initialize()" style="margin:0px; padding:0px; width:100%; height:100%">
        <div id="container"></div>
    </body>

</html>

Observation:
When the displayed image (html file) is smaller than the webview it is possible to scroll vertical and horizontal as long as the touch event is “outside” the shown html. Normally my picture is very large so there is no chance at all to touch outside and scroll.

I am not sure if its a problem within WebView itself or the html page. Any ideas how i can get the scrolling back to work?

I greatly appreciate every answer =) Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:16:29+00:00Added an answer on June 14, 2026 at 8:16 pm

    I found a solution:

    I implemented my own onTouchListener and do the scrolling on my own. Got the idea from another SO quesition/answer (Android: Scrolling an Imageview)

    Thought this might be helpful to others as it seems to be a little buggy in the WebView with certain html files, loaded from file:///…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple html files which i saved in the assets folder. one of
I have some html content which has to be displayed on android webview. Here
I have a simple application with a WebView which loads an html page. The
I have a WebView on my Android application which loads ( WebView.loadUrl() ) different
I have a Android Application which is basically uses WebView for all interaction.. How
I have an android application in which I need to get the HTML code
OK, so I have a HTML5 website which is wrapped in an Android WebView.
I have a little problem... I have made an Android application which extends the
I have seen various discussions on the problem of serving WebView pages from assets,
I have an Android app using webview to load and display html pages. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.