diff --git a/lib/src/main/java/com/yalantis/contextmenu/lib/MenuObject.java b/lib/src/main/java/com/yalantis/contextmenu/lib/MenuObject.java index 4f0e3ec..e949bac 100644 --- a/lib/src/main/java/com/yalantis/contextmenu/lib/MenuObject.java +++ b/lib/src/main/java/com/yalantis/contextmenu/lib/MenuObject.java @@ -1,6 +1,5 @@ package com.yalantis.contextmenu.lib; -import android.annotation.TargetApi; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; @@ -45,12 +44,10 @@ public void setTitle(String title) { this.mTitle = title; } - @TargetApi(16) public Drawable getBgDrawable() { return mBgDrawable; } - @TargetApi(16) public void setBgDrawable(Drawable mBgDrawable) { this.mBgDrawable = mBgDrawable; mBgColor = 0; diff --git a/lib/src/main/java/com/yalantis/contextmenu/lib/Utils.java b/lib/src/main/java/com/yalantis/contextmenu/lib/Utils.java index 7f1b279..238c194 100644 --- a/lib/src/main/java/com/yalantis/contextmenu/lib/Utils.java +++ b/lib/src/main/java/com/yalantis/contextmenu/lib/Utils.java @@ -100,7 +100,11 @@ public static RelativeLayout getImageWrapper(Context context, MenuObject menuIte if (menuItem.getBgColor() != 0) { imageWrapper.setBackgroundColor(menuItem.getBgColor()); } else if (menuItem.getBgDrawable() != null) { - imageWrapper.setBackground(menuItem.getBgDrawable()); + if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { + imageWrapper.setBackgroundDrawable(menuItem.getBgDrawable()); + } else { + imageWrapper.setBackground(menuItem.getBgDrawable()); + } } else if (menuItem.getBgResource() != 0) { imageWrapper.setBackgroundResource(menuItem.getBgResource()); } else {