I need to open a bottom sheet with some content, and I want the accessibility focus to stay in that bottom sheet. I've tried to open the sheet in a view, in a separate fragment, in a PopupWindow, but anyway it was possible to move the focus "bellow" my sheet. Is there any way to solve that?
Thank you.
Related
i have done the implementation of com.google.android.material.bottomsheet.BottomSheetBehavior and i want to show the whole bottom sheet on top of keyBoard when user click for searching.
help will be appreciated thanks
here is my image
Adding this line
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
to the onCreateView() of your bottom fragment could be a potential fix.
I have an activity with BottomNavigation. If the user needs to click on the submit button soft keyboard hides it. Then he again needs to press the back button to see the submit button. In this case, I used windowSoftInputMode='adjustResize' so that the screen gets resized automatically and the user can scroll up and click on the submit button.
But, I have BottomNavigation too, windowSoftInputMode='adjustResize' makes BottomNavigation float above the soft keyboard. Can anyone suggest a better solution? Any help will be appreciated. Thanks
Thats tricky issue... You have two options in here:
Keep 'adjustResize' and hide BottomNavigation view when keyboard pops up (e.g. simply setVisiblity?)
Change to e.g. 'adjustPan' (or any other) preventing keyboard resizing app and add bottom padding with height of keyboard for whole content container. BottomNavigation will stay hidden under keyboard, but padding will allow scrolling to Submit button
In both cases you need to detect open/close keyboard, in second case you will also need keyboard height measuring. IN HERE and HERE you have big SO topics about this case, check out answers and comments, and pick proper resolution for your purposes
Initially the bottom sheet is remains hidden, when I click on some place then bottom sheet should appear and when I click clear icon then the bottom sheet should be hidden actual manner, which is should be on initial state.
Initial App launch code:
bottomSheetInfoBehavior.setHideable(true);
bottomSheetInfoBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
After clicking on some place then this is the code which pops up the bottom sheet:
bottomSheetInfoBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
Finally when the clear icon is clicked then this the code that is hiding the bottom sheet (NOT WORKING):
bottomSheetInfoBehavior.setHideable(true);
bottomSheetInfoBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
Expected Result is:
When the clear icon is clicked then the bottom sheet should not appear in the screen, that should be disabled..! and should not visible in screen..!
You should use Bottom sheet's dismiss method in clear button.
And
use show method to show the BottomSheet dialog.
Keep the reference of BottomSheetDialog and use is accordingly.
From the code you have shared u are setting the state/behaviour of the BottomSheet which will be taken care by these method's automatically.
Ref:
BottomSheetDialog
I use a Modal Bottom Sheet to allow the user to enter some text and create Decisions or Tasks.
Some users want to close the keyboard and they tap outside of the Bottom Sheet and close it. This is a big issue because all the text is lost.
The material design documentation states that it can be dismissed when the outside is touched but this doesn't work for me.
I want to intercept the onOutsideClick event and check the keyboard's state:
Keyboard shown: Close the soft keyboard
Keyboard hidden: Dismiss the Bottom Sheet
Should I use a custom BottomSheetBehavior or can I Override some dialog methods?
In my Android app, I'd like to slide a custom view up from the bottom of the screen while the keyboard is onscreen, either overlaying the keyboard or temporarily animating it out of the way. Ideally the view would be the same size as the keyboard. The user would briefly reference with the custom view, then tap to dismiss it, bringing back the keyboard.
How would I go about doing this? Thanks.