1

Это мой XML макет:SwipeRefreshLayout с WebView в CoordinatorLayout

<?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" 
    android:id="@+id/coordinatorLayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appBarLayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 
      <include 
       android:id="@+id/toolbar" 
       layout="@layout/tool_bar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       app:layout_scrollFlags="scroll|enterAlways" /> 
    </android.support.design.widget.AppBarLayout> 

    <android.support.v4.widget.SwipeRefreshLayout 
     android:id="@+id/swipeContainer" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

     <WebView 
      android:id="@+id/web_view" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      /> 

    </android.support.v4.widget.SwipeRefreshLayout> 
</android.support.design.widget.CoordinatorLayout> 

К сожалению, панель инструментов не скрывая при WebView прокрутки.

Как использовать WebView с SwipeRefreshLayout и скрытой панелью инструментов?

Извините за мой английский.

ответ

8

Использование NestedScrollView так:

<android.support.v4.widget.SwipeRefreshLayout 
    android:id="@+id/swipeContainer" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

    <android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <WebView 
      android:id="@+id/web_view" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 

    </android.support.v4.widget.NestedScrollView> 
</android.support.v4.widget.SwipeRefreshLayout> 
+0

я не использую CoordinatorLayout но NestedScrollView помочь мне. Благодаря! – 1f7

+0

Спасибо! ты спасаешь мой день! –

+0

Это здорово, также решена моя проблема с прокруткой, запускающей нежелательное обновление – ihhcarus

Смежные вопросы