简体   繁体   English

如何将Android中的Webview置于最前面?

[英]How to bring webview in android to front?

I have an android application in which upon clicking “netbank icon” I am launching a webview with URL loaded in it, with the help of method webview.loadUrl(). 我有一个android应用程序,在其中单击“ netbank图标”后,将使用webview.loadUrl()方法启动一个加载了URL的webview。 When I press hard key back on the device it goes to the previous screen. 当我在设备上按硬键时,它将转到上一个屏幕。

Now I am on the screen which has “netbank icon”. 现在,我在屏幕上显示“ netbank图标”。 Upon clicking this icon I want to show the previous webview again without loading new url. 单击此图标后,我想再次显示以前的Web视图而不加载新的URL。 I just want to bring that webview to front. 我只是想将这个Webview放在前面。 What is the way out for that? 出路是什么?

I have tried webview.bringtofront() but it only show a blank screen. 我已经尝试过webview.bringtofront(),但它只显示空白屏幕。

if the webview is being loaded in a new activity, then when you press the hard back button basically, onDestroy() of that activity is called, which means activity no more exists and when u again click the icon the activity is created once again....hence you cannot get the same web view state when you once go back and then come again... 如果正在将Web视图加载到新活动中,则当您基本上按下硬性后退按钮时,将调用该活动的onDestroy(),这意味着该活动不再存在,并且当您再次单击该图标时,将再次创建该活动。 ...因此,当您再次返回然后再次访问时,您将无法获得相同的网络视图状态...

you may find something of your interest here: http://developer.android.com/reference/android/webkit/WebView.html 您可能会在这里找到您感兴趣的东西: http : //developer.android.com/reference/android/webkit/WebView.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM