I have a ViewPager that shows 3 fragments. One of the fragments has got a WebView and I am experiencing 2 issues:
1) It seems that the size of the ViewPager (height) is bigger than the screen size. (see following image)
2) Scrolling is working correctly when switching from a tab to another on, while it is not working vertically when the APP is landscape orientation. When in landscape mode I can scroll up the page touching the toolbar and the TabLayout but I cannot scroll up touching the WebView. What I am trying to do is to scroll up touching the WebView and not only the Tab or Toolbar.How can I do that?
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context="com.it.rocks4x4.activities.MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:layout_scrollFlags="scroll|enterAlways|snap"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<!--
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="REGISTRA"
android:elevation="6dp"
android:textSize="18dp"
android:textColor="@color/black"
app:layout_anchor="@id/fab"
app:layout_anchorGravity="center"/>-->
<TextView
android:id="@+id/fab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="10dp"
android:background="@drawable/button_shape"
android:elevation="10dp"
android:fontFamily="sans-serif"
android:gravity="center"
android:text="@string/msg_inizia_registrare"
android:textColor="#FFF"
android:textSize="@dimen/size25sp"
android:textStyle="bold"
tools:layout_editor_absoluteX="28dp" />
</android.support.design.widget.CoordinatorLayout>
fragment
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/black"
tools:context="com.it.rocks4x4.activities.MainActivity$PlaceholderFragment">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webviewbussola"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_alignParentBottom="true" />
</RelativeLayout>
Thanks