2016-03-31 4 views
0

Ich bin neu bei Android, in meiner Anwendung bin die Verwendung der Navigation Schublade Aktivität (Materail Design) und haben ein Webview in einem Fragment. Die Navigation lädt Webview ohne Probleme. Aber ich kann das webview nicht vertikal scrollen, ich kann horizontal tun. Ich kann die vertikale Scrollbar auf horizontaler Rolle sehen, aber nicht funktionell. Hierandroid navigation schublade material design webview no vertikal scrollen

ist das Fragment XML-Code

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/colorDefaultGray" 
    tools:context="com.cell.cell.fragments.MainWebViewFragmant"> 

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

    <ProgressBar 
     style="?android:attr/progressBarStyleLarge" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/progressBar" 
     android:layout_gravity="center" /> 

</FrameLayout> 

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

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     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:popupTheme="@style/AppTheme.PopupOverlay" /> 

     <FrameLayout 
      android:id="@+id/fragment_container" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"></FrameLayout> 

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

    <!--<include layout="@layout/content_main" />--> 


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

Ich versuchte andere Lösung, wie NestedWebView und versuchte, den Webansicht-Tag in NestedScrollview zu setzen, aber kein Glück. Bitte geben Sie eine Lösung für diesen

Vielen Dank im Voraus

Antwort

1

Sie Ihre FrameLayout in Ihrem AppBarLayout versehentlich Einwickeln, Ihre FrameLayout unterhalb dem AppBarLayout bewegen.

Also, was passiert, ist das AppBarLayout nimmt Ihre Scroll-Ereignis statt der 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:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="com.cell.cell.MainActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     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:popupTheme="@style/AppTheme.PopupOverlay" /> 
    </android.support.design.widget.AppBarLayout> 

    <!-- Move your FrameLayout outside the AppBarLayout --> 
    <FrameLayout 
      android:id="@+id/fragment_container" 
      app:layout_behavior="@string/appbar_scrolling_view_behavior" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"/> 


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

Dann in kitkat Geräte, Die Statusleiste versteckt Das y ist innerhalb AppBarLayout Tag – user3421325

+0

in kitkat hinzugefügt es keine Färbung ist der Status der Weg versperren sie auf Lollipop Geräten funktioniert, ist dies das Standardverhalten ist. –

+0

Versucht, aber die App-Statusleiste füllt den Bildschirm ... Kann das Fragment nicht anzeigen – user3421325