My application has a webview without any searchtool, like a fullscreen mode.
When i clik on a link, the search bar with the address of the site appear.
How can i hide it ? I would like to continue in fullscreen mode.
I finaly found something interesting here :
http://developer.android.com/guide/webapps/webview.html
in the section "handling page navigation"
I'll make some tests.
Related
I am trying to disable, remove or hide the context menu that appears when highlighting text natively in android. http://i.stack.imgur.com/caUOw.png (My reputation is too low to include it in this post :P) The top right button on the green header is intended to be the selectable context menu in the app. The native context menu appearing lags the app and confuses the user's experience based on testing.
I've tried:
Overriding ActionMode.Callback in the cordova generated MainActivity. After accessing the menu (mode.getMenu()) I could clear it(menu.clear()) http://i.stack.imgur.com/t9chW.png. But! menu.close() does not close the context menu.
Creating an empty menu view and calling the action mode's menu inflater on the empty menu.
-webkit-touch-callout: none; in the javascript.
Please help!
Adding the following code to your CSS stylesheet should prevent this behavior in a WebView:
body {
-webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
}
Unsure if you're looking to disable in a WebView or in native UI components.
Even thoush this is an old question, i wanted to share my solution because it took me quite a while to figure out.
Catch the 'contextmenu' event and preventDefault().
<input style="text" oncontextmenu="e=>e.preventDefault()"/>
or
myHtmlElement.addEventListener('contextmenu', e => e.preventDefault())
I'm trying to make a mobile site using Kohana 3 and Bootstrap 3, but I got a problem. My collapsed menu isn't working. When I am trying to view the site on my Android Smartphone (4,3") and i press the menu button in the right top corner, it won't show the menu items. This is the code for my navigation bar;
http://pastebin.com/0bprF68u
(i suck with formatting the code in the tags, sorry)
Nevermind i'm dumb, loaded the javascript file of bootstrap before the javascript file of jQuery.
I am trying to solve the issue that in my Webview, when a user selects a textfield, the keyboard that appears covers the text field below.
Instead, I need a behavior where the text field is moved right above the keyboard, like what the flag SOFT_INPUT_ADJUST_PAN would do.
Based on testing, it seems like by default on a Webview, it is displaying the keyboard below the field.
But my WebView is in fullscreen. I am calling this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN) in my activity);
and this seems to make android stop doing the default 'pan and scan' behavior.
I've tried to call
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
and even
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
but that did not fix it.
I need to set the activity to fullscreen because I want to hide both the title bar and the status bar, so removing it is not an option unless there is another way to hide the status bar.
Any idea on how to solve this issue?
Laurent
You need to remove FLAG_FULLSCREEN flag. There is a bug somewhere in the OS machinery and with some digging around i have found the following:
without any extra scroll view around web view adjustPan never worked for me. Unfortunatelly the add scroll view also not always helps.
adjustScroll works for me when FLAG_FULLSCREEN is not present for the activity the webview is in.
So to sum it up the safest option to go with when it comes to WebView is adjustResize not full screen activity.
For me this worked:
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
I am trying to build a quick search box. it is basically a widget. Upon clicking, it pops up the quick search box and launch the browser with query string. No activity except searchactivity.
And also added codes for 'recent query suggestion' But having a problem to have menu for 'clear history' Here is what I wanted to implement. When quick search box is displayed, by pressing menu button, I want option menu to be popped up, keypad to be disappeared, quick search box to be stayed.
the implementation of google sample code - Searchable dictionary is not what I want to implement. It starts an activity with instruction message and when a user presses the search button or menu button, it pops up the quick search box. Mine is when it runs from a widget, the quick search box is popped up right away just like the google search widget.
How can I override onCreateOptionMenu on searchmanager? Or is there any way to activate option menu when the searchmanager is activated?
Please take a look at the images below. the second image is what I want to implement upon clicking menu button.
What you need to do is make the search button launch the default search activity when it is pressed. And make it sorta match the existing search dialog style. You can notice this is how the official Twitter client works. You can use apktool (google it) to take a look at the official Twitter clients resource files to get a better idea of how this can be accomplished.
There are posts all over the internet about how to hide the address bar in a WebView, but by default the WebView activity does hide the address bar. I'm interested in actually showing the address bar on a WebView inside my own Activity. However, I don't want to pop out to the default browser, because I am using my own WebViewClient which utilizes onPageStarted to detect when a success URL is reached and finish() back to the parent activity.
I want the address bar to show the user that they are actually at the URL they think they are so that they don't accuse me of phishing. Is there a way to have a WebView show its address bar with its current URL?
WebView "does not include any features of a fully developed web browser, such as navigation controls or an address bar" as per the developer docs.
You could implement a toast or alike to show where the user is being tacking...?