我有一个问题:
<?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:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
当我在webview中滚动时,工具栏被隐藏或显示(完美!)但是加载/定位网页时出现问题.例如,如果我滚动到页面的中间并单击链接,则将加载的新页面也位于页面的大约中间而不是顶部.好像滚动条没有从一个页面移动到另一个页面.
如果我添加到NestedScrollView:
android:fillViewport="true"
Run Code Online (Sandbox Code Playgroud)
一切都适用于webview(页面加载并显示良好,虽然从顶部开始)但我丢失隐藏/显示与工具栏:(
你对这个问题有什么看法吗?
预先感谢您的帮助 :)
(有关信息:Android设计支持库:23.0.1)
烨