bottom-sheet

android BottomSheet how to collapse when clicked outside?

纵然是瞬间 提交于 2019-12-03 04:50:16
问题 I have implemented bottomsheet behavior with NestedScrollView. And was wondering if it is possible to hide the bottomsheet view when touched outside. 回答1: Finally I was able to do this, Used the following lines of code: @Override public boolean dispatchTouchEvent(MotionEvent event){ if (event.getAction() == MotionEvent.ACTION_DOWN) { if (mBottomSheetBehavior.getState()==BottomSheetBehavior.STATE_EXPANDED) { Rect outRect = new Rect(); bottomSheet.getGlobalVisibleRect(outRect); if(!outRect

Customizing Persistent Bottom Sheet STATE_EXPANDED height or offset

℡╲_俬逩灬. 提交于 2019-12-03 03:40:14
Like the titles said, is there anyway to customize the size/height/offset of the official bottomSheet (Support library 23.x.x) when it is in STATE_EXPANDED state? There is a class BottomSheetBehavior but I can't find anything about height or offset. What I want is get a similar behavior like Google Maps: MiguelHincapieC After digging on Android code and searching I got it: You can do it modifying default BottomSheetBehavior adding one more stat with following steps: Create a Java class and extend it from CoordinatorLayout.Behavior<V> Copy paste code from default BottomSheetBehavior file to

How to handle issues of the new bottom sheet of the support/design library?

不问归期 提交于 2019-12-02 18:31:21
Background I've used a modified version of bottom-sheet library ( here , based on this library , also wrote about it here ), in order to have a nice transition between collapsed (AKA "peeked") state and expanded state. The library had its issues, but in general I've fixed them all. The problem Recently we've found that after going back from all ad-networks screens, back to one that has a bottom sheet, the bottom sheet gets into a weird state of being expanded. I've decided that it's time to try the new bottom-sheet of the support library (shown here ), but I've found that it has a lot of basic

Google map touch on bottom sheet dialog

浪子不回头ぞ 提交于 2019-12-01 07:15:31
问题 I have a google map fragment on the top of my bottom sheet dialog. I disabled the draggable touch action on the bottom sheet behavior so that I could control the map. The problem is that I can't scroll the map using up or down touch actions because of my bottom sheet draggable disabled. I was thinking to disable the touch action of the bottom sheet behavior when the user touches the map but I don't know how to do this. How can I fix this? 回答1: Try adding nestedScrollingEnabled="true" to the

BottomSheetDialogFragment - listen to dismissed by user event

这一生的挚爱 提交于 2019-12-01 02:23:24
How can I listen to a FINAL dismissal of a BottomSheetDialogFragment ? I want to save user changes on the final dismissal only... I tried following: Method 1 This only fires, if the dialog is dismissed by swiping it down (not on back press or on touch outside) @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog d = super.onCreateDialog(savedInstanceState); d.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { BottomSheetDialog d = (BottomSheetDialog) dialog; FrameLayout bottomSheet = (FrameLayout) dialog

Android : Multi line text EditText inside BottomSheetDialog

邮差的信 提交于 2019-11-30 17:20:36
问题 I have a bottom sheet dialog and exists EditText in layout. EditText is multiline, max lines is 3. I put : commentET.setMovementMethod(new ScrollingMovementMethod()); commentET.setScroller(new Scroller(bottomSheetBlock.getContext())); commentET.setVerticalScrollBarEnabled(true); but when user will begin scrolling text of EditText vertically BottomSheetBehavior intercept event and EditText will not scroll vertically. Anybody know how to solve this problem? 回答1: Here is an easy way to do it.

Try to Understand the behavior of BottomSheet in android support library 23.2.1

a 夏天 提交于 2019-11-30 15:12:42
问题 I am trying to implement Bottom sheet in one of my activities and I am kind of confused by the way it is behaving! So here is the problem, I have an activity in which I am trying to show Bottom sheet and I see that: if we dont set the app:behavior_peekHeight property then the Bottom sheet never works If you set the PeekHeight to something less than 30dp (basically just to hide it from screen) If you set app:behavior_peekHeight to more than 30dp in layout file and try to set the state of

BottomSheetBehavior is not work when design library update to 24.2.0

你离开我真会死。 提交于 2019-11-30 13:58:46
问题 BottomSheetBehavior work properly in compile 'com.android.support:design:24.1.1' but when I update it to 24.2.0,it is not work.Is that a bug? This is my code: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" > <LinearLayout android:id="@+id

BottomSheetDialog/BottomSheetDialogFragment — which to use and how?

大兔子大兔子 提交于 2019-11-30 11:04:12
I'm working on a Material design app. One feature I want to implement is some kind of a poll. When a user clicks an element of a list, the persistent bottom sheet dialog, which looks like this should show up: Then, when user clicks any button, this dialog should go away and the modal bottom sheet dialog should show up, providing a user with more information about the list item which was clicked at the beginning. It looks like this: I can't find any clear explanations about BottomSheetDialog and BottomSheetDialogFragment, and how to use them correctly, even after reading some information about

Show entire bottom sheet with EditText above Keyboard

假如想象 提交于 2019-11-30 07:20:37
I'm implementing a UI where a bottom sheet will appear above the keyboard with an EditText for the user to enter a value. The problem is the View is being partially overlapped by the keyboard, covering up the bottom of the bottom sheet. Here is the Bottom Sheet and no keyboard. Here is the Bottom Sheet with the keyboard showing. What's the best method to ensure the entire Bottom Sheet is shown? Thanks. Just reposting @jblejder from this question Keyboard hides BottomSheetDialogFragment since it worked for me, to make it easier for others to find: The most convenient way that I found to change