How to pinch to zoom in a WebView inside ScrollView?
I know I should have avoided using WebView inside a ScrollView but I have to. I have the following layout:
<ScrollView android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="wrap_content"> <RelativeLayout android:id="@+id/relativebelowscroll" android:layout_width="match_parent" android:layout_height="match_parent"> <WebView android:id="@+id/jobcontent" android:layout_width="match_parent" android:layout_height="wrap_content" android:animateLayoutChanges="true"> </WebView> <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/jobcontent" android:visibility="visible" app:adSize="BANNER" app:adUnitId="ca-app-pub-XXXXXXXXXXXXXXXXXX" /> <!--The following should be shown on ad failed to load --> <LinearLayout android:id="@+id/dimage" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/jobcontent" android:background="#367AB8" android:gravity="center_vertical|center_horizontal" android:visibility="visible"> <ImageView android:id="@+id/dimage2" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_gravity="left|center_horizontal" android:src="@drawable/banner_left" android:visibility="visible" /> <ImageView android:id="@+id/dimage3" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_gravity="right" android:src="@drawable/banner_right" android:visibility="visible" /> </LinearLayout> </RelativeLayout> </ScrollView> Its working good but the zoom in gesture having some problems as it is inside a ScrollView. I have looked other same questions but they all suggests to remove ScrollView but I cant in this particular case. I have a adview just below WebView so when user scrolls it scrolls all the way to adview but if I dont use ScrollView the scroll ends till the WebView gets its end on scroll. It doesn't scroll below WebView to show that adview. So in this case the ScrollView is needed and can't be removed. If I use this layout than I can pinch zoom but can't scroll below WebView content to show adview.
<WebView android:id="@+id/jobcontent" android:layout_width="match_parent" android:layout_height="wrap_content" android:animateLayoutChanges="true"> </WebView> <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/jobcontent" android:visibility="visible" app:adSize="BANNER" app:adUnitId="ca-app-pub-XXXXXXXXXXXXXXX" /> <LinearLayout android:id="@+id/dimage" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/jobcontent" android:background="#367AB8" android:gravity="center_vertical|center_horizontal" android:visibility="visible"> <ImageView android:id="@+id/dimage2" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_gravity="left|center_horizontal" android:src="@drawable/banner_left" android:visibility="visible" /> <ImageView android:id="@+id/dimage3" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_gravity="right" android:src="@drawable/banner_right" android:visibility="visible" /> </LinearLayout> Is there any possibility to show pinch to zoom in my situation or get the second layout scroll working till adview?