0
我创建了一个webview,其中如果单击一个外部链接,它将转到另一个带有加载的外部链接的webview。我希望它能够返回到它所导航的页面,如果我的后退按钮被点击的话。例如,如果我从主webview的第4页导航到某个外部链接webview,并且如果我点击返回它应该返回到第4页而不是第1页。这是我的XML页面供参考。从一个webview导航到另一个
<WebView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/activity_main_webview"/>
<WebView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:id="@+id/external_webview">
</WebView>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:id="@+id/ext_link"
android:layout_height="fill_parent">
<RelativeLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:background="#FFFFFF"
android:layout_height="45dp"
android:weightSum="1">
<Button
android:id="@+id/backtonews"
android:layout_marginTop="7dp"
android:layout_width="190dp"
android:layout_height="30dp"
android:background="@drawable/button">
</Button>
<Button
android:id="@+id/refresh"
android:layout_marginTop="7dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/refresh"
android:layout_alignParentRight="true"
android:singleLine="false">
</Button>
</RelativeLayout>
我无法为它写回功能。你能告诉我如何去做的细节。 '' //做你的工作here' ; '@ Override' '公共无效onBackPressed(){'' super.onBackPressed(): –
你当返回键通过重写onBackPressed方法压制始终可以做到的手动操作'}' –
我可以编写正常的后台功能,但我想知道如何存储我们在代码为 –