search

Home  >  Q&A  >  body text

Android WebView的滚动条不显示

已经加入了这样的代码:

            myWebView.setVerticalScrollBarEnabled(true);
            myWebView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);

却仍然不显示进度条。
布局文件:

<?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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar_custom"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <WebView
            android:id="@+id/webView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:scrollbarStyle="outsideOverlay" />
    </android.support.v4.widget.NestedScrollView>
        <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab_favorite"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end|bottom"
        android:layout_margin="@dimen/fab_margin"
        android:src="@drawable/ic_favorite_white_24dp"
        app:layout_behavior="com.drunkpiano.zhihuselection.utilities.ScrollingFavoriteFABBehavior" />
</android.support.design.widget.CoordinatorLayout>

请问问题出在哪里呢,谢谢

天蓬老师天蓬老师2773 days ago676

reply all(2)I'll reply

  • 怪我咯

    怪我咯2017-04-17 17:03:35

    You should be fine if you remove android.support.v4.widget.NestedScrollView.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:03:35

    Removeandroid.support.v4.widget.NestedScrollView,然后将FloatingAcitonButton锚到WebView右下角结束的地方,在FloatingAcitonButtonand add the following code inside

    app:layout_anchor="@id/webView"
    app:layout_anchorGravity="bottom|right|end"  

    reply
    0
  • Cancelreply