我对此有问题:
<?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>
当我在Webview中滚动时,工具栏会隐藏或显示(非常好!),但加载/定位网页存在问题。例如,如果我滚动到页面的中间并点击链接,则加载的新页面也将位于页面的中间位置而不是顶部。就像滚动条没有从一个页面移动到另一个页面一样。如果我在NestedScrollView中添加:android:fillViewport="true"
所有内容都可以在Webview中正常工作(页面可以加载并且显示良好,尽管从顶部开始),但是我失去了工具栏的隐藏/显示功能 :(
你有什么关于这个问题的想法吗?
提前感谢您的帮助 :)
(附注:Android Design Support Library: 23.0.1)
Yop