0

I have a webview in a coordinator layout together with the appbar. My toolbar overlaps some part of my webview and on scroll, the toolbar is hidden hence revealing the hidden part of the webview concealed by the toolbar. I would like my webview to be positioned below the toolbar and match parent when the toolbar is hidden.How can I go about it? >

    <?xml version="1.0" encoding="utf-8">

 <android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
      android:background="#ffffff"
      xmlns:app="http://schemas.android.com/tools"
      android:fitsSystemWindows="true"
 android:layout_width="match_parent"
android:layout_height="match_parent"
           android:id="@+id/coordinatorLayout"


>  
     < android.support.design.widget.AppBarLayout
 android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:id="@+id/appbar"

>

<android.support.v7.widget.Toolbar
    android:layout_height="?attr/actionBarSize"
    android:layout_width="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:elevation="4dp"
    app:layout_scrollFlags="scroll|enterAlways"
    android:background="#e0e0e0"
    app:titleTextColor="#FFFFFF"
    app:popupTheme="@style/MyParentTheme.PopupOverlay"

    android:id="@+id/toolbar"


    />

     </   android.support.design.widget.AppBarLayout>

<com.kenyanews.inception.NestedWebView


    android:id="@+id/webview"
    android:layout_width="match_parent"
              android:layout_height="match_parent"
    android:background="#55ff0000"
app:layout_behavior="@string/     appbar_scrolling_view_behavior" />

  </android.support.design.widget.CoordinatorLayout>
HM88
  • 95
  • 2
  • 8
  • I think this will help you in an easy way http://stackoverflow.com/questions/28770530/how-to-hide-actionbar-toolbar-while-scrolling-down-in-webview – Jerassi Ferrer Mar 30 '16 at 22:44

1 Answers1

0

Another way to hide the tool bar is this one:

In order to hide the Toolbar your can just do something like this:

toolbar.animate().translationY(-toolbar.getBottom()).setInterpolator(new AccelerateInterpolator()).start();

Wish it helps you

Jerassi Ferrer
  • 284
  • 2
  • 8
  • Hiding the toolbar is not the problem,,It's just that the toolbar hides part of the webview before scrolling occurs – HM88 Mar 30 '16 at 22:57