How to enable webpage scaling for linear layout in Android?

I made an application that has a transparent image on the web view. The zoom function is enabled in my web browser, but after I put the transparent image in transparent LinearLayoutin Webview, I can’t enable the zoom. Perhaps transparent LinearLayout(containing a partial transparent image) does not Webviewlimit the touch event that should be detected on Webview. So how can I solve this? The screenshot of the application looks like the image below.

enter image description here

Webview.xml file: -

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <WebView
    android:id="@+id/WebView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:layout_weight="1"
    android:gravity="bottom|center" />
    </RelativeLayout>

search_image.xml file: -

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@null"
    android:orientation="vertical"
    android:id="@+id/overlayLayout"
    android:weightSum="1">
    <ImageView
    android:id="@+id/imageView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/menu_search"/>
    </LinearLayout>
+4
source share
1

WebView?

, ScrollView ScrollView.

<.

. , ScrollView .

, WebView ScrollView.

onCreate :

    webView.getSettings().setBuiltInZoomControls(true);

.

0

Source: https://habr.com/ru/post/1619800/


All Articles