androideveloper 2015-10-20 02:55 采纳率: 50%
浏览 8801
已结题

CoordinatorLayout+NestedScrollView + webview 。

想监听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>
  • 写回答

2条回答 默认 最新

  • Robot-S 2015-10-20 03:11
    关注

     
    WebView是一个专门用来显示网页的View子类。它使用WebKit渲染引擎来显示网页,并且支持包括前进,后退,放大,缩小,文本搜索等多种功能。
    WebView有一个辅助类叫WebSettings,它管理WebView的设置状态。该类的对象可以通过WebView.getSettings()方法获得。下面我们介绍几个常用的WebSettings设置:
    view plainp......
    答案就在这里:WebView
    ----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?

    评论

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站