List of usage examples for android.view View setBackgroundDrawable
@Deprecated public void setBackgroundDrawable(Drawable background)
From source file:android.support.v7.testutils.AppCompatTintableViewActions.java
/** * Sets background drawable on a <code>View</code> that implements the * <code>TintableBackgroundView</code> interface. *///from w w w. j a v a 2s . co m public static ViewAction setBackgroundDrawable(final Drawable background) { return new ViewAction() { @Override public Matcher<View> getConstraints() { return allOf(TestUtilsMatchers.isTintableBackgroundView()); } @Override public String getDescription() { return "set background drawable"; } @Override public void perform(UiController uiController, View view) { uiController.loopMainThreadUntilIdle(); view.setBackgroundDrawable(background); uiController.loopMainThreadUntilIdle(); } }; }
From source file:dev.gautam.todoapp.utils.ActivityUtils.java
public static void setBackGround(Context context, View view, @DrawableRes int drawable) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(ContextCompat.getDrawable(context, drawable)); } else {/*from w ww .j a v a 2 s . c o m*/ view.setBackgroundDrawable(ContextCompat.getDrawable(context, drawable)); } }
From source file:com.justplay1.shoppist.utils.ViewUtils.java
@SuppressWarnings("deprecation") public static void setBackground(View view, Drawable drawable) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(drawable);/* www.jav a2 s. c o m*/ } else { view.setBackgroundDrawable(drawable); } }
From source file:com.acious.android.paginationseekbar.internal.compat.SeekBarCompat.java
@SuppressWarnings("deprecation") public static void setBackground(View view, Drawable background) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { SeekBarCompatDontCrash.setBackground(view, background); } else {/* www .java 2 s .co m*/ view.setBackgroundDrawable(background); } }
From source file:Main.java
@SuppressLint("NewApi") @SuppressWarnings("deprecation") public static void setBackground(Context ctx, View view, boolean night, int lightResId, int darkResId) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { view.setBackground(ctx.getResources().getDrawable(night ? darkResId : lightResId, ctx.getTheme())); } else {/*from w ww . j a va 2 s . c o m*/ view.setBackgroundDrawable(ctx.getResources().getDrawable(night ? darkResId : lightResId)); } }
From source file:net.qiujuer.genius.ui.compat.UiCompat.java
/** * android.support.v4.view.ViewCompat SHOULD include this once and for all!! * But it doesn't...//from w w w . j a va 2 s .co m * * @param view View * @param background DrawableBackground */ @SuppressWarnings("deprecation") public static void setBackground(View view, Drawable background) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { UiCompatNotCrash.setBackground(view, background); } else { view.setBackgroundDrawable(background); } }
From source file:net.qiujuer.genius.ui.widget.compat.GeniusCompat.java
/** * android.support.v4.view.ViewCompat SHOULD include this once and for all!! * But it doesn't.../* w w w . ja va 2s .c o m*/ * * @param view View * @param background DrawableBackground */ @SuppressWarnings("deprecation") public static void setBackground(View view, Drawable background) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { GeniusCompatNotCrash.setBackground(view, background); } else { view.setBackgroundDrawable(background); } }
From source file:Main.java
@SuppressWarnings("deprecation") public static void setBackground(View view, Drawable background) { if (view != null && background != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(background); } else {/*from ww w .j a va 2 s . co m*/ view.setBackgroundDrawable(background); } } }
From source file:Main.java
static void setRipple(View view, int pressedColor, Integer normalColor) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { view.setBackground(getRippleDrawable(pressedColor, normalColor)); } else {// ww w . j a v a2 s. c o m view.setBackgroundDrawable(getStateListDrawable(pressedColor, normalColor)); } }
From source file:Main.java
/** * Hack to fix pre JB MR1 Kudos to @cyrilmottier * * @param view view drawable attached too. * @param drawable drawable which gets invalidated *//* w w w . j av a2 s . com*/ static void fixParallaxBackgroundPreJBMR1(final View view, final Drawable drawable) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2) { drawable.setCallback(new Drawable.Callback() { @Override public void invalidateDrawable(Drawable who) { view.setBackgroundDrawable(who); } @Override public void scheduleDrawable(Drawable who, Runnable what, long when) { } @Override public void unscheduleDrawable(Drawable who, Runnable what) { } }); } }