3
<FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <WebView
        android:id="@+id/webView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clickable="true"
        android:focusable="true"
        android:focusableInTouchMode="true"
        />

    <View
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/darkView"
        android:background="#99000000"
        android:visibility="gone"
        />
    </FrameLayout>

I want the webview to be scrollable in the current scenario. It's not scrolling right now. What should I do?

The complete .xml file of which the above code is part of is:

<?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"
    android:orientation="vertical">


    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <WebView
            android:id="@+id/webView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clickable="true"
            android:focusable="true"
            android:focusableInTouchMode="true"
            />

        <View
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:focusable="false"
            android:focusableInTouchMode="false"
            android:clickable="false"
            android:id="@+id/darkView"
            android:background="#99000000"
            android:visibility="gone"
            />
    </FrameLayout>

    <SlidingDrawer
        android:id="@+id/bottom"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerHorizontal="true"
        android:orientation="vertical"
        android:layout_marginTop="120dp"
        android:content="@+id/content"
        android:handle="@+id/handle"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:clickable="true"
        >

        <ImageView
            android:id="@+id/handle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/iris" />

        <LinearLayout
            android:id="@+id/content"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:gravity="center_horizontal">

            <TextView
                android:id="@+id/tvabc"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Share This:"
                android:textColor="#a3a3a3"
                android:padding="10dp"
                android:fontFamily="sans-serif"
                android:background="#eeeeee"
                android:gravity="center_horizontal"/>

            <View
                android:layout_width="fill_parent"
                android:layout_height="0.1dp"
                android:background="@android:color/darker_gray"/>

            <ListView
                android:id="@+id/lv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#eeeeee">
            </ListView>
            <View
                android:layout_width="fill_parent"
                android:layout_height="4dp"
                />
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/bCancel"
                android:text="Cancel"
                android:background="#eeeeee"
                android:textColor="#11d8f5"/>

            <View
                android:layout_width="fill_parent"
                android:layout_height="4dp"
                />

        </LinearLayout>
    </SlidingDrawer>

</RelativeLayout>
Vaibhav Jani
  • 12,428
  • 10
  • 61
  • 73
Musarrat Saeed
  • 83
  • 1
  • 1
  • 11

1 Answers1

3

Try something like this :

    <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        <WebView
            android:id="@+id/webView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clickable="true"
            android:focusable="true"
            android:focusableInTouchMode="true"
            />

        <View
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:focusable="false"
            android:focusableInTouchMode="false"
            android:clickable="false"
            android:id="@+id/darkView"
            android:background="#99000000"
            android:visibility="gone"
            />
    </FrameLayout>

Issue is due to SlidingDrawer not due to FrameLayout. Try alternate code where I just made SlidingDrawer android:clickable="false" and it worked :

<?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"
    android:orientation="vertical">


    <FrameLayout
        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:clickable="true"
            android:focusable="true"
            android:focusableInTouchMode="true"
            />

        <View
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:focusable="false"
            android:focusableInTouchMode="false"
            android:clickable="false"
            android:id="@+id/darkView"
            android:background="#99ff0000"
            android:visibility="visible"
            />
    </FrameLayout>

    <SlidingDrawer
        android:id="@+id/bottom"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerHorizontal="true"
        android:orientation="vertical"
        android:layout_marginTop="120dp"
        android:content="@+id/content"
        android:handle="@+id/handle"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:clickable="false"
        >

        <ImageView
            android:id="@+id/handle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/go_button" />

        <LinearLayout
            android:id="@+id/content"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:gravity="center_horizontal">

            <TextView
                android:id="@+id/tvabc"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Share This:"
                android:textColor="#a3a3a3"
                android:padding="10dp"
                android:fontFamily="sans-serif"
                android:background="#eeeeee"
                android:gravity="center_horizontal"/>

            <View
                android:layout_width="fill_parent"
                android:layout_height="0.1dp"
                android:background="@android:color/darker_gray"/>

            <ListView
                android:id="@+id/lv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#eeeeee">
            </ListView>
            <View
                android:layout_width="fill_parent"
                android:layout_height="4dp"
                />
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/bCancel"
                android:text="Cancel"
                android:background="#eeeeee"
                android:textColor="#11d8f5"/>

            <View
                android:layout_width="fill_parent"
                android:layout_height="4dp"
                />

        </LinearLayout>
    </SlidingDrawer>

</RelativeLayout>
Vaibhav Jani
  • 12,428
  • 10
  • 61
  • 73
  • Life saver! But why is slidingDrawer causing problem? What it has to do with webView scrolling? – Musarrat Saeed Jul 08 '15 at 12:19
  • 1
    @MusarratSaeed Consider the fact that your drawer's height and width is also *match_parent* so it is covering entire WebView and making it untouchable! – Vaibhav Jani Jul 08 '15 at 12:36