android-webview

Android: how to add custom soft keyboard when form field is selected in WebView

流过昼夜 提交于 2019-12-21 12:22:07
问题 I am using WebView to present UI. Is there any way that I can trigger custom soft keyboard when input text form field is selected? 回答1: I just encounter a similar problem with the android WebView. When I select, in touch mode, a text input field, it does not pop-up the virtual keyboard whereas with the trackball it works fine. I just found there: http://groups.google.com/group/android-developers/browse_thread/thread/e52109afda599301/b4cbc16e4e9e8e0d (last message from alien9) that calling

Is getElementById() efficient? [duplicate]

北战南征 提交于 2019-12-21 08:05:15
问题 This question already has answers here : JavaScript: document.getElementById slow performance? (10 answers) Closed 3 years ago . I often use the method getElementById("id1"); in my methods. I use it to find certain elements in my HTML. I wonder if I need to be concerned about how much I use it if it has to search the entire DOM every time. How does this method work? Does it parse the DOM and return the element when it is found, or does it have all those values indexed somehow and so is able

Android WebView html5 video force fullscreen

只愿长相守 提交于 2019-12-21 06:36:15
问题 I have been working on this issue for at least one week. I have read all the post about it in StackOverflow but I still not founding the solution and I am starting to think that this is impossible. I want to display an HTML in a webview embebbed in a layout like this: The problem is that if that HTML code has an HTML5 video inside it will be cropped due to a bug in Android OS: Link to bug. I have tried many workarounds but none of them seems to be working. My last attempt is to show the video

How to remove the header in Android WebView? (While Loading)

♀尐吖头ヾ 提交于 2019-12-21 06:29:53
问题 I want to remove the header of the website in android ' WebView '. With the Code that I have, it works. But the problem is that the ' WebView ' is removing the header after the page loaded completely. I want to remove it, while it is loading. Thats the code snippet: webView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { webView.loadUrl("javascript:(function() { " + "var head = document.getElementsByTagName('header')[0];" + "head

Android Oreo WebView renders layout too small after 2nd loading

牧云@^-^@ 提交于 2019-12-21 06:01:12
问题 On some Android Oreo devices, when I load an url on webview for the first time, the URL page loads properly. However, when I load the URL again, the page is zoomed out. On devices lower than android oreo, the page loads properly for all devices. Also, when you kill the app on the background and load again, the URL loads properly. On the second and succeeding tries, it shows the zoomed out version again. I attached the images of loaded URL below Below is the correct loading of webpage on the

Disable contextual Action bar in android webview on text selection

霸气de小男生 提交于 2019-12-21 06:00:32
问题 How to disable contextual action bar in web view? I Want text selection feature to remain as it is , but i don't want the Contextual action bar to come, how can i disable it ? Using this code hides the contextual action bar but it is looking bad(whole screen is shaking ) and also text selection is not retaining. @Override public void onSupportActionModeStarted(ActionMode mode) { super.onSupportActionModeStarted(mode); mode.finish(); } How can i disable the contextual actionbar ? Is there any

Is there a way to override the behavior of WebView?

岁酱吖の 提交于 2019-12-21 05:18:08
问题 I get the WebView from my layout: WebView webView = (WebView) rootView.findViewById(R.id.myWebView); I want to override the behavior of onKeyDown . Normally, I can override it by subclassing. WebView webView = new WebView(this) { @Override public boolean onKeyDown (int keyCode, KeyEvent event) { // Do my stuff.... } } However, since I got the WebView by using findViewById , is there a way to override the method? P.S: It is actually a much more complicated case, and I can't Override onKeyDown

Webview.loadData not working on 8.1 and 9.0

故事扮演 提交于 2019-12-21 04:38:11
问题 I have an article app, I am showing articles in webview. In android version 8.1 and 9.0 This webview is not working. The app shows NOTHING in article activity. mWebView.setVisibility(View.VISIBLE); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setLoadWithOverviewMode(true); mWebView.getSettings().setUseWideViewPort(true); mWebView.getSettings().setMinimumFontSize(14); String htmlContent = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + "<head>" + "<meta http-equiv=

WebView with embedded video plays in background

99封情书 提交于 2019-12-21 04:29:33
问题 I have a WebView that hosts embedded videos. when I degrade the Webview the sound of the video keeps on playing. How can I stop this? I did try webview.destroy(); but that force closes the application when I try to open the WebView again. 回答1: You must call the WebView's onPause() and onResume() methods for that purpose. You typically do it on your Activity's onPause() and onResume() but you can also do it whenever you are hiding the WebView in some way and its contents shoud also stop doing

CORS issue with Tomcat and Android Webview

南笙酒味 提交于 2019-12-21 04:28:15
问题 I am facing a strange problem with Tomcat 8 and CORS. I am developing a Hybrid web app using ionicframework, AngularJS, Cordova as front end and Tomcat 8 and Spring 3 as back-end. For easy development I am testing the functionality in chrome , where things are working fine. I added CORS filter with standard configuration to allow CROSS ORIGIN requests from browser. Today I converted my app into Android App and started making AJAX calls to tomcat server. To my surprise things stopped working .