HyB*_*RiD 15 android webview android-scrollview crosswalk-runtime android-coordinatorlayout
我想实现滚动Toolbar
技术(隐藏Toolbar
使用同级子视图上下滚动时)CoordinatorLayout
和AppBarLayout
.
我正在使用Crosswalk的XWalkView(它是一个像WebView一样的视图).
使用常规WebView(在a内NestedScrollView
)我可以实现想要的效果:
<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.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
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"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webViewOrig"
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)
然而,当以XWalkView
相同的方式使用时,我无法让它工作.使用以下XML布局后:
<android.support.v4.widget.NestedScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport = "true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<org.xwalk.core.XWalkView
android:id="@+id/webViewCross"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.NestedScrollView>
Run Code Online (Sandbox Code Playgroud)
视图甚至没有出现.
删除以下行时
app:layout_behavior="@string/appbar_scrolling_view_behavior"
Run Code Online (Sandbox Code Playgroud)
在XWalkView
至少显示,但在整个屏幕上,并在工具栏的顶部.
我该怎么做才能让它发挥作用?因为它是一个开源我应该能够使它工作...我怀疑它是子类XWalkView
并实现一些接口(NestedScrollingChild
?)或通过子类CoordinatorLayout.Behavior
或创建自定义行为AppBarLayout.ScrollingViewBehavior
.
有任何想法吗?
BTW XWalkView
在内部使用SurfaceView或TextureView来呈现Web内容.
归档时间: |
|
查看次数: |
1043 次 |
最近记录: |