नहीं मिला मैं कोड में गतिशील रूप से एक लहर को बनाना चाहता हूं।RippleDrawable
कोड:
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
buyButton.setBackground(getPressedColorRippleDrawable(primaryColor, darkerVariant));
}
public static RippleDrawable getPressedColorRippleDrawable(int color, int darkerVariant) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ColorStateList colorStateList = new ColorStateList(
new int[][]
{new int[]{}},
new int[]
{darkerVariant}
);
return new RippleDrawable(colorStateList, new ColorDrawable(color), null);
}
return null;
}
यह लॉलीपॉप पर काम करता है, लेकिन मेरी GNEX (4.3) पर ऐप्लिकेशन क्रैश बनाता है।
त्रुटि:
Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method fragments.ProductDetailFragment.getPressedColorRippleDrawable
07-17 12:57:45.757 30992-30992/com.comizzo.ginsonline E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.VerifyError: fragments/ProductDetailFragment
लेकिन RippleDrawable क्योंकि कोड निष्पादित नहीं है Gnex पर इस्तेमाल कभी नहीं किया है।
मैं इसे कैसे ठीक कर सकता हूं?