简体   繁体   中英

How do I register a callback for a dismissableFrameLayout in Android?

I'm trying to use this layout component . I just don't know how to register a callback. I need to register the onDismissFinished callback but I'm at a loss. I'm working in Java, Thanks.

There are plenty of examples on github.

For example using viewBinding

https://github.com/joharei/nearby-mobility/blob/5e0244b4daeb0aac04c5dc661c7dde6c1769cf21/app/src/main/java/app/reitan/nearby_mobility/MainActivity.kt

        ActivityMainBinding.inflate(layoutInflater).apply {
            setContentView(root)

            swipeDismissRootContainer.registerCallback(object :
                DismissibleFrameLayout.Callback() {
                override fun onDismissFinished(layout: DismissibleFrameLayout) {
                    // Hides view before exit to avoid stutter.
                    layout.visibility = View.GONE
                    finish()
                }
            })

https://github.com/search?q=DismissibleFrameLayout&type=code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM