I am using a sliding menu over a webview.
I need to disable or blur the webview when the menu is open.
On adding a framelayout and setting foreground, the webview can be blurred but is not disabled and is still scrollable/clickable.
How can I completely freeze the view beneath?
The easiest way is to add enable or disable clicks to the webview by setting the view that is overlayed on top to either be clickable or not clickable.
You can try creating a method like the one below of use the setClickable() method in another similar fashion.
public void setClickable(boolean isClickable){
blurView.setClickable(isClickable);
}
While your overlay is clickable it will intercept all touch events and the user will not be able to interact with the webview.
Note you can set the default behavior for a view easily in xml as well by using this line
android:clickable="true"
Related
We have an app that uses a Webview to render a text editor (contentEditable) inside of a React Native application. This works well overall, except that the Android back gesture can lead to changes in the selection of text inside the Webview and similar strange behaviors.
We've tried things like having an element along the screen edge that pops out to overlay the Webview when a user begins a back gesture, tried with both onPress and onPressIn.
But by that time, it's already too late to evt.preventDefault() - and the text selection takes place even though the Webview is now covered by another element, I guess because it's technically still the same event that triggered the overlay. (Also tried evt.stopPropagation in desperation.)
Is there any way to prevent text selection within our Webview when a user uses the back gesture?
How would I go about creating a dynamic Gif keyboard for Android? I would like the user to scroll horizontally across the Gif's and possibly search across them via an integrated search bar in the keyboard
I've seen this link but it doesn't talk about dynamically changing the keys: How to make a Android custom keyboard?
In your InputMethodService there is a callback onCreateInputView()
You can create whatever custom view you want and return in there.
For horizontal scrolling, maybe look at view pager
I have a transparent view in my app on top of a few fragments. So my fragments are below the transparent overlay, but they are not reachable by the user while the overlay is opened, as touching the overlay will dismiss it. All work fine up to the point when I enable TalkBack
My problem is that when I have TalkBack enabled and I swipe to select the next element, once TalkBack has finished with everything in the overlay, it will start setting focus on items below overlay. Is there any way to stop it from doing so? Something similar to the android:clickable="true" or using an onClick listener for making the transparent overlay intercept all clicks?
On API 19+, you can set the accessibility importance of root view of the hierarchy that you want to hide from TalkBack to be NO_HIDE_DESCENDANTS. This will prevent TalkBack from focusing anything in that hierarchy, and this is how we handle the navigation drawer scrim.
On previous versions, there's no good way to accomplish this. There are some bad ways involving manually hiding nodes from the AccessibilityNodeInfo for the root view, though, and you can check those in the DrawerLayout source code.
Currently, when I build a popup all the view in the activity are blocked (blacked), it's normal.
But i want to allow 1 view (FloatingActionButton) to be accessible (so not blacked). Do you have some ideas ?
Thanks for your propositions !
Popup dialog takes all the screen as a normal behaviour and the Activity/Fragment layout behind gets unfocused... go for a Visibility trick to achieve that.
Make a layout using Relative layout and place a "dialog style" relative layout in front of everything else and set Visibility.VISIBLE when the user touch a button (or any other action) and Visibility.GONE to remove it from the view. (also, use setEnabled(false) to make sure non of the options inside that layout trigger a listener).
Anyway... all this goes against the UI/UX normal behaviour for users, I shouldn’t recommended you to go that way.
What is THAT important inside the FAB to left it available? Popup dialogs are for "YES/NO", "OK" options (mostly)
The original problem I am fighting is more complex but for investigating purposes I have simplified the test case to the following:
Single fullscreen activity
Programmatically created web view that occupies roughly half of the horizontal screen space, 90% of the vertical space and is added to the root view via within the onCreate call:
ViewGroup parent = (ViewGroup) getWindow().getDecorView().getRootView();
parent.addView(myWebView);
web view opens to google.com via:
loadUrl("http://google.com")
AndroidManifest.xml has the property:
"android:windowSoftInputMode="adjustPan"
When clicking on the search box on the google page the keyboard pops up but the web view itself is not shifted up as adjustPan indicates should happen. The main activity also has a native text field that when clicked will shift the entire layout (including web view) up as expected.
The behavior is present on 4.2.2 on both a Nexus 7 and Galaxy Nexus.
So the question is how can I have the windowSoftInputMode property adjustPan be applied correctly to a web view instance so that when the soft keyboard is displayed the entire web view is shifted up by the vertical space taken up by the keyboard.
Before I go down the road of trying to manipulate the layout manually within onMeasure I want to see if there is a consistent / better way to handle this. The browser obviously handles this situation correctly so not sure why the web view is not able to handle this.
One thing to note is that making the web view fullscreen or a separate activity are not possible options due to an existing architecture that I am not able to change.
If we use the full screen without action bar adjustResize will not work. See this thread for details adjustPan not preventing keyboard from covering EditText