List of usage examples for android.view View setBackgroundDrawable
@Deprecated public void setBackgroundDrawable(Drawable background)
From source file:Main.java
/** * Sets a background {@link Drawable} on a view. * //from w ww .j av a2 s . c om * @param view * @param drawable */ @SuppressWarnings("deprecation") public static void setBackgroundDrawable(View view, Drawable drawable) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { setBackgroundJB(view, drawable); } else { view.setBackgroundDrawable(drawable); } }
From source file:Main.java
/** * <pre>//from w w w .j av a 2s.c o m * Set {@link Drawable} as background of a view, which is different in API < 16 and API >= 16. * </pre> * @param view target view * @param drawable background drawable */ @SuppressLint("NewApi") @SuppressWarnings("deprecation") public static void setBackgroundDrawable(View view, Drawable drawable) { if (view == null) return; if (Build.VERSION.SDK_INT >= 16) { view.setBackground(drawable); } else { view.setBackgroundDrawable(drawable); } }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public static void setViewBackground(View view, Drawable background) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(background);//from w ww .j a v a 2 s .co m } else { //noinspection deprecation view.setBackgroundDrawable(background); } }
From source file:Main.java
/** * This method sets background of given view. * //from ww w. j a va2 s. c om * @param context * @param view * @param drawable */ @SuppressWarnings("deprecation") public static void setViewBackground(Context context, View view, BitmapDrawable drawable) { // TODO Auto-generated method stub if (Build.VERSION.SDK_INT >= 16) { view.setBackground(drawable); } else { view.setBackgroundDrawable(drawable); } }
From source file:Main.java
/** * Sets background from drawable resource * /*ww w. java 2 s. c o m*/ * @param view * view object for set drawable resource * @param resourceId * drawable resource */ @SuppressWarnings("deprecation") @SuppressLint("NewApi") public static void setBg(View view, final int resourceId) { Drawable res = view.getResources().getDrawable(resourceId); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { view.setBackgroundDrawable(res); } else { view.setBackground(res); } }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public static void setViewBackgroundDrawable(View view, Drawable drawable) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(drawable);/*from ww w . j av a 2 s . c o m*/ } else { //noinspection deprecation view.setBackgroundDrawable(drawable); } }
From source file:Main.java
public static void makeRoundCorner(View v, int color, int radius) { GradientDrawable gradientDrawable = new GradientDrawable(); gradientDrawable.setColor(color);//from w ww.jav a2 s . c o m gradientDrawable.setCornerRadius(radius); if (Build.VERSION.SDK_INT < 16) v.setBackgroundDrawable(gradientDrawable); else v.setBackground(gradientDrawable); }
From source file:Main.java
@SuppressWarnings("deprecation") private static void setBackgroundDrawable(View view, Drawable drawable) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(drawable);//from www . j a v a2 s. c o m } else { view.setBackgroundDrawable(drawable); } }
From source file:Main.java
/** * This method sets background of given view. * /*from www. ja va2 s. c o m*/ * @param context * @param view * @param drawable */ @SuppressWarnings("deprecation") public static void setViewBackground(Context context, View view, int drawable) { // TODO Auto-generated method stub if (Build.VERSION.SDK_INT >= 16) { view.setBackground(context.getResources().getDrawable(drawable)); } else { view.setBackgroundDrawable(context.getResources().getDrawable(drawable)); } }
From source file:com.gc.markdown.utils.ViewUtils.java
/** * ?AndroidAPIView// w w w .j a v a2 s. c om * According to the Android version, calls the Settings in the View background method of version API * * @param view view * @param drawable drawable */ public static void setViewBackgroundDrawable(View view, Drawable drawable) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(drawable); } else { view.setBackgroundDrawable(drawable); } }