2016-08-28 2 views
1

모든 최신 라이브러리 사용. CoordinatorLayout 조각 안에 간단한 WebView가 있습니다. 사용자가 sdown을 스크롤 할 때 도구 모음을 숨기려고합니다.NestedScrollView, SwipeRefreshLayout 및 WebView를 함께 사용하는 방법은 무엇입니까?

<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/clRootHome" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
tools:context="com.bytefury.deliverzz.fragment.HomeFragment"> 

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    app:layout_scrollFlags="scroll|enterAlways" 
    android:theme="@style/AppTheme.AppBarOverlay"> 

    <include layout="@layout/toolbar" /> 

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

<android.support.v4.widget.SwipeRefreshLayout 
    android:id="@+id/srlHome" 
    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" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

     <im.delight.android.webview.AdvancedWebView 
      android:id="@+id/frag_wv_wv" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scrollbarStyle="insideOverlay" /> 

</android.support.v4.widget.NestedScrollView> 

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



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

그러나 이것은 전혀 수행하지 않습니다. 새로 고침을하려면 스 와이프하여 올바르게 작동합니다.

NestedScrollView 및 SwipeRefreshLayout을 전환 할 때 필자는 빈 화면이 나타납니다. 당신이 당신의 도구 모음 스크롤 수 있도록하려면

+0

'NestedScrollView'가 필요 없다고 생각합니다. webview는 스크롤을 잘 처리해야합니다. – bubunyo

+0

내가 분명하지 않을 수 있습니다. NestedScrollView가 사용되므로 webView가 스크롤 될 때 툴바가 숨겨집니다. – jpf

+0

당신은'NestedScrollView'없이 그것을 달성 할 수 있습니다. 나는 대답을 게시 할 것이다. – bubunyo

답변

0

은 이제 도구 모음 레이아웃이 추가이

<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/clRootHome" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="com.bytefury.deliverzz.fragment.HomeFragment"> 

     <include layout="@layout/toolbar" /> 

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

     <im.delight.android.webview.AdvancedWebView 
      android:id="@+id/frag_wv_wv" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scrollbarStyle="insideOverlay" /> 

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

로 레이아웃을 리팩토링.

 app:layout_scrollFlags="scroll|enterAlways" 
+1

질문에 대답 할 때 저자를 위해서뿐만 아니라 미래의 방문자에게도 도움이되도록하십시오. 또한 추가 한 내용에 대해 더 명확히 말하면 코드를 제공하지 마십시오. –

관련 문제