I have discovered a strange behavior. If I set this snipped as a shapeAppearanceOverlay to the bottom sheet, I get a glitch. When I try to close the bottom sheet by dragging to the bottom I can see that rounded corners animate out for a moment and return back after that.
I think it should be rounded all the way while I'm dragging the dialog and became square only in full height mode, shouldn't it?
<style name="ShapeAppearanceOverlay.App.BottomSheet.Modal" parent="ShapeAppearanceOverlay.MaterialComponents.BottomSheet.Modal">
<item name="cornerSizeTopLeft">@dimen/custom_corner_large</item>
<item name="cornerSizeTopRight">@dimen/custom_corner_large</item>
</style>
Could you please provide some more context for this bug? Specifically, any relevant XML for this bottom sheet, as well as any code you're using to programmatically initialize, modify, or show the bottom sheet.
@gsajith Sure. Thanks for the replying.
My bottom sheet superclass. I just inherit it and show with ::show(childFragmentManager)
abstract class BaseBottomSheetDialogFragment
: BottomSheetDialogFragment(),
HasSupportFragmentInjector {
@Inject
lateinit var viewModelFactory: ViewModelFactory
@Inject
lateinit var childFragmentInjector: DispatchingAndroidInjector<Fragment>
protected open val skipCollapsed = false
override fun onAttach(context: Context) {
AndroidSupportInjection.inject(this)
super.onAttach(context)
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
dialog.setOnShowListener { dialogInterface ->
val d = dialogInterface as BottomSheetDialog
val bottomSheet = d.findViewById<View>(com.google.android.material.R.id.design_bottom_sheet) as FrameLayout
val behavior = BottomSheetBehavior.from(bottomSheet)
behavior.skipCollapsed = skipCollapsed
if (skipCollapsed)
behavior.state = BottomSheetBehavior.STATE_EXPANDED
// d.window?.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
// d.window?.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
// d.window?.navigationBarColor = ContextCompat.getColor(requireContext(), R.color.white)
}
return dialog
}
override fun supportFragmentInjector(): AndroidInjector<Fragment>? {
return childFragmentInjector
}
override fun onSaveInstanceState(outState: Bundle) {
StateSaver.saveInstanceState(this, outState)
super.onSaveInstanceState(outState)
}
@CallSuper
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
StateSaver.restoreInstanceState(this, savedInstanceState)
}
protected open fun getTagLabel(): String {
return TAG
}
fun show(manager: FragmentManager) {
show(manager, getTagLabel())
}
companion object {
private const val TAG = "dialog"
}
}
The layout:
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
</data>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbarStyle="insideOverlay"
android:scrollbars="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:padding="@dimen/padding_16">
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
Video: https://www.evernote.com/l/AmiRaAtmJ-FHdI2Maaw_lP3F63_E5HErteY
Having exactly the same issue 馃憤
Hi @Zeliret, thanks for bringing this to our attention! Someone internally noticed a similar issue and is contributing a fix -- I'll comment back here when that fix is synced out!
Alpha09 is here but still no fix for that issue ;(
I need this. Please fix it as soon as possible.
Happens to me too!
Same here. I'm using v1.2.0-alpha03 馃槶
I'm facing a similar issue. When I click a list item of rounded cornered BottomSheetDialogFragment, then the rounded corners turn into a squared corners. See the video attached.
https://drive.google.com/open?id=1iO8ljZXsHEOkttsoQo9lgm0cyIaTivvr
I have the same issue!
Same issue whenever the bottom sheet content takes focus, round corners have gone completely.
Most helpful comment
Having exactly the same issue 馃憤