想监听webview滚动 CoordinatorLayout+NestedScrollView 用NestedScrollView 包裹webview 无法让webview位于topbar下方。原本应该可以在下方,但是提示包裹webview的NestedScrollView height必须fillparent。所以webview沾满了屏幕topbar相当于一个fragment一样盖在了webview上挡住了一些东西
想要的效果就是正常的webview在topbar下方 布局如下:
<?xml version="1.0" encoding="utf-8"?>
<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" >
<RelativeLayout
android:id="@+id/rl_content"
android:layout_width="match_parent"
android:layout_height="fill_parent">
<android.support.v4.widget.NestedScrollView
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView
android:id="@+id/action_webkit"
android:layout_width="match_parent"
android:layout_height="fill_parent"
/>
</android.support.v4.widget.NestedScrollView>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="6dp"
android:progressDrawable="@drawable/progress_drawable" />
</RelativeLayout>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/top_bar"
app:layout_scrollFlags="scroll|enterAlways"
android:id="@+id/top"/>
</android.support.design.widget.AppBarLayout>
。。</CoordinatorLayout>
WebView是一个专门用来显示网页的View子类。它使用WebKit渲染引擎来显示网页,并且支持包括前进,后退,放大,缩小,文本搜索等多种功能。
WebView有一个辅助类叫WebSettings,它管理WebView的设置状态。该类的对象可以通过WebView.getSettings()方法获得。下面我们介绍几个常用的WebSettings设置:
view plainp......
答案就在这里:WebView
----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?
你别用RelativeLayout啊!你用linearlayout不就解决了么