我已经创建了一个网页视图,如果一个外部链接被点击,它就会转到另一个加载了外部链接的网页视图。我希望它的方式是,如果我的后退按钮被点击,它就会返回到它所在的页面。例如,如果我从主网页视图的第4页导航到某个外部链接网页视图,如果我单击“上一步”,它应该返回到第4页,而不是第1页。这是我的XML页面以供参考。
<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>发布于 2016-04-25 18:15:11
在进入第二个网页之前,你必须在第一个网页视图中存储最后一个网页,然后听back键,然后用保存的地址弹出第一个网页视图
如果你想知道更多细节,请告诉我。
https://stackoverflow.com/questions/36837514
复制相似问题