Skip to content

Instantly share code, notes, and snippets.

@safaorhan
Last active October 18, 2019 13:10
Show Gist options
  • Save safaorhan/af0935ddc69fe91b3146a075caa1e3e2 to your computer and use it in GitHub Desktop.
Save safaorhan/af0935ddc69fe91b3146a075caa1e3e2 to your computer and use it in GitHub Desktop.
Disables the child attach listener so that inflated children with wrap_content heights can pass.
/**
* Disables the child attach listener so that inflated children with wrap_content heights can pass.
*
* This is very fragile and depends on the implementation details of [ViewPager2].
*
* @see ViewPager2.enforceChildFillListener (the removed listener)
*/
private fun ViewPager2.removeMatchParentCheckForChildren() {
(getChildAt(0) as RecyclerView).clearOnChildAttachStateChangeListeners()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment