Forked from MohammadAG/gist:3503e08deac416a3b71a
Last active
August 29, 2015 14:06
-
-
Save lethargicpanda/3cd02638b3b6326ee949 to your computer and use it in GitHub Desktop.
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment