This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To instantiate a RippleDrawable: | |
// new RippleDrawable(null, null), the default constructor isn't public. | |
// Unfortunately, this has no colors set, so the app will crash, here's another way | |
int[] attrs = new int[] { android.R.attr.selectableItemBackground}; | |
TypedArray array = getContext().obtainStyledAttributes(attrs); | |
Drawable drawableFromTheme = array.getDrawable(0); | |
array.recycle(); | |
setBackground(drawableFromTheme); |