Skip to content

Instantly share code, notes, and snippets.

@alistairsykes
Created April 7, 2020 07:31
Show Gist options
  • Save alistairsykes/cb67ec485ba0c24a70bb90b5752bfca3 to your computer and use it in GitHub Desktop.
Save alistairsykes/cb67ec485ba0c24a70bb90b5752bfca3 to your computer and use it in GitHub Desktop.
val background = itemView.background
if (background is RippleDrawable) {
itemView.postOnAnimationDelayed({
background.setHotspot(
(itemView.width * 0.75).toFloat(),
(itemView.height * 0.5).toFloat()
)
background.state = intArrayOf(
android.R.attr.state_pressed,
android.R.attr.state_enabled
)
itemView.postDelayed({
background.state = intArrayOf()
}, 200)
}, 100)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment