Fai*_*yaz 10 android toolbar webview android-viewpager nestedscrollview
我添加了Toolbar,Tablayout并Viewpager在我的Android应用程序中.有三个Tabs中TabLayout,每个显示WebView.我把它WebView放在一个NestedScrollView隐藏/显示Toolbar用户向下/向上滚动的位置WebView.Toolbar隐藏在Android 3.0或更高版本中.但不幸的是,在Android 2.3或更低版本WebView中,首先不会滚动.我必须刷到另一个Tab,当我Tab再次回到First 时WebView开始滚动.
我想要的是?
我希望它WebView应该滚动Android 2.3或更少没有任何问题.
我的WebView
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:isScrollContainer="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="1dp">
<WebView
android:id="@+id/webviewtool"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:numColumns="1"
android:scrollbars="none"
android:focusableInTouchMode="false"
android:focusable="false"
android:background="#FFFFFF" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
Run Code Online (Sandbox Code Playgroud)
尝试使用这个库: https: //github.com/ksoichiro/Android-ObservableScrollView这个库适用于 API 9+。但请记住,2.3 在视觉效果、动画等方面存在很多问题
您还可以下载并检查以下代码示例:“ActionBarControlWebViewActivity WebView & Action Bar”,这正是您所寻找的。链接:ActionBar 和 WebView
就像这样使用它一样简单:
ObservableWebView webView = (ObservableWebView) findViewById(R.id.web);
webView.setScrollViewCallbacks(this);
webView.loadUrl("file:///android_asset/lipsum.html");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1135 次 |
| 最近记录: |