2016-08-22 2 views
0

두 개의 도구 모음과 webview가있는 앱이 있습니다. 사용자가 webview에서 위로 슬라이드하면 상단 툴바가 슬라이드 및 숨겨져 야하며, YouTube 툴과 마찬가지로 상단 툴바가 슬라이드되어 표시되어야합니다.webview ocuping 전체 화면, 도구 모음 포함

<?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:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="com.moover.moover.MainActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     android:fitsSystemWindows="true"> 

     <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:background="?attr/colorPrimary" 
       app:popupTheme="@style/AppTheme.PopupOverlay" 
       app:layout_scrollFlags="scroll|enterAlways" /> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar2" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:background="?attr/colorPrimary" 
       app:popupTheme="@style/AppTheme.PopupOverlay"> 
       <TextView 
        android:id="@+id/textViewWebPage" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" /> 
      </android.support.v7.widget.Toolbar> 

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

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/rcView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     /> 

    <WebView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/webview" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     /> 

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

는 현재 웹보기 전체 화면을 ocupying 도구 모음을 취재하고 도구 모음을 덮고있는 웹보기에 대해서

답변

1

스크롤 아니다 : 이 tutorial 이 앱 바 레이아웃 안에 뷰를 이동 시도하거나 간단하게 만들 수에 따라 content_main.xml 파일을 열어 뷰에 포함 시키십시오.

만들기 웹뷰 그것을 스크롤 할 수있는 두 가지 방법이 있습니다

1)를 사용하여 XML의 : 인 부모가 있어야 웹보기있는 ScrollView 같은 :

 <ScrollView 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 
      <WebView android:id="@+id/web_view" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content"/> 
     </ScrollView> 

2) 코드에서 설정 :

WebView webView = (WebView) findViewById(R.id.web_view); 
webView.setHorizontalScrollBarEnabled(true); 
webView.setVerticalScrollBarEnabled(true);