How to disable BottomSheetDialogFragment dragging

There is simpler way of achieving the same after material design 1.2.0 was released. https://developer.android.com/reference/com/google/android/material/bottomsheet/BottomSheetBehavior#setdraggable When calling from BottomSheetDialogFragment: override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val bottomSheetDialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog bottomSheetDialog.setOnShowListener { val bottomSheet = bottomSheetDialog .findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet) if (bottomSheet != null) { val behavior: BottomSheetBehavior<*> = BottomSheetBehavior.from(bottomSheet) behavior.isDraggable = false } } return bottomSheetDialog … Read more

Keyboard hides BottomSheetDialogFragment

I found the solution for 27 api. So the reason why keyboard hides view even with SOFT_INPUT_ADJUST_RESIZE is that the windowIsFloating is set for Dialogs. The most convenient way that I found to change this is by creating style: <style name=”DialogStyle” parent=”Theme.Design.Light.BottomSheetDialog”> <item name=”android:windowIsFloating”>false</item> <item name=”android:statusBarColor”>@android:color/transparent</item> <item name=”android:windowSoftInputMode”>adjustResize</item> </style> And set this in onCreate method … Read more

Custom smaller Detents in UISheetPresentationController?

For iOS 16+ Swift – custom(identifier:resolver:) ObjC – customDetentWithIdentifier:resolver: For iOS 15 : Use +[UISheetPresentationControllerDetent _detentWithIdentifier:constant:]. It’s a private method. Sample Summary: UIKitCore`+[UISheetPresentationControllerDetent _detentWithIdentifier:constant:] Address: UIKitCore[0x00000001838d50fc] (UIKitCore.__TEXT.__text + 17876312)

How do you adjust the height and borderRadius of a BottomSheet in Flutter?

Default height for bottomSheet is half the screenSize If you want your bottomSheet to EXPAND according to your content DYNAMICALLY use below code showModalBottomSheet<dynamic>( isScrollControlled: true, context: context, builder: (BuildContext bc) { return Wrap( children: <Widget>[…] ) } ) This will automatically expand the bottomSheet according to content inside. For adding a radius on top … Read more

android BottomSheet how to collapse when clicked outside?

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.contains((int)event.getRawX(), (int)event.getRawY())) mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); } } return super.dispatchTouchEvent(event); } Hope it save someone’s whole day!

How to create BottomSheetDialogFragment using Navigation Architecture Component?

In the navigation component version 2.1.0-alpha04, Navigation Graph can contain dialog as one of the destinations. <?xml version=”1.0″ encoding=”utf-8″?> <navigation xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:id=”@+id/main_navigation” app:startDestination=”@id/startFragment”> <fragment android:id=”@+id/loginFragment” android:name=”com.awesomeproject.android.authentication.login.LoginFragment” android:label=”Login” tools:layout=”@layout/login_fragment” /> <dialog android:id=”@+id/bottomSheet” android:name=”com.awesomproject.android.BottomSheetFragment” tools:layout=”@layout/bottom_sheet_dialog_fragment” /> </navigation> The BottomSheetFragment will look similar to other BottomSheet. class BottomSheetFragment : BottomSheetDialogFragment() { override fun onCreateView(inflater: LayoutInflater, container: … Read more

How can I dim the background when Bottomsheet is displayed, without using Dialog?

You can use this code 1. MainActivity.xml <android.support.design.widget.CoordinatorLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:id=”@+id/main_content” android:layout_width=”match_parent” android:layout_height=”match_parent” android:fitsSystemWindows=”true”> <ScrollView android:layout_width=”match_parent” android:layout_height=”match_parent” app:layout_behavior=”@string/appbar_scrolling_view_behavior”> <LinearLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” android:paddingTop=”24dp”> <Button android:id=”@+id/button_1″ android:layout_width=”match_parent” android:layout_height=”wrap_content” android:text=”Button 1″ android:padding=”16dp” android:layout_margin=”8dp” android:textColor=”@android:color/white” android:background=”@android:color/holo_green_dark”/> </LinearLayout> </ScrollView> <View android:visibility=”gone” android:id=”@+id/bg” android:background=”#99000000″ android:layout_width=”match_parent” android:layout_height=”match_parent”/> <android.support.v4.widget.NestedScrollView android:id=”@+id/bottom_sheet” android:layout_width=”match_parent” android:layout_height=”350dp” android:clipToPadding=”true” android:background=”@android:color/holo_orange_light” app:layout_behavior=”android.support.design.widget.BottomSheetBehavior” > <TextView android:layout_width=”match_parent” android:layout_height=”match_parent” android:text=”aefwea” android:padding=”16dp” android:textSize=”16sp”/> … Read more

Sliding up image with Official Support Library 23.x.+ bottomSheet like google maps

If you want to achieve it using Support Library 23.4.0.+ I will tell you how I got it and how its works. As far I can see that activity/fragment has the followings behaviors: 2 toolbars with animations that respond to the bottom sheet movements. A FAB that hides when it is near to the “modal … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)