###前提・実現したいこと
NestedScrollViewと連動したwebviewで、スクロールを行うとtoolbarが隠れるようになるアプリです。
webviewのリンクをタップし次のページに遷移すると、タップする前のページ位置が新しいページにも適用され、一番上に移動されません。
新規ページであれば単純に、位置を0にしてしまえばいいのですが、goBack,gofowerdでも同様にタップ時の位置に移動してしまい、以前の位置になりません。
NestedScrollView無しで行ったときと同様な、goBack,gofowerdを使用した場合、位置を以前の位置に戻すようにすることは可能でしょうか?
###該当のソースコード
<?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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.myapplication.MainActivity"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" app:layout_scrollFlags="scroll|enterAlways|snap" /> </android.support.design.widget.AppBarLayout> <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="fill_vertical" app:layout_behavior="@string/appbar_scrolling_view_behavior" > <WebView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/webView" /> </android.support.v4.widget.NestedScrollView> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" app:srcCompat="@android:drawable/ic_dialog_email" /> </android.support.design.widget.CoordinatorLayout>
###補足情報(言語/FW/ツール等のバージョンなど)
android studio 2.3.2
android 4.4.2
jdk 8
あなたの回答
tips
プレビュー