List of usage examples for android.widget ImageView setImageResource
@android.view.RemotableViewMethod(asyncImpl = "setImageResourceAsync") public void setImageResource(@DrawableRes int resId)
From source file:Main.java
public static void clearImage(ImageView image) { image.setImageResource(android.R.color.transparent); }
From source file:Main.java
public static void settingPicture(ImageView imageView, int imageRes) { imageView.setImageResource(imageRes); }
From source file:Main.java
public static void setImageResource(View view, int id, int resId) { ImageView imageView = findViewById(view, id); imageView.setImageResource(resId); }
From source file:Main.java
public static ImageView getItemImageView(Context context, @DrawableRes int placeholderResId, ImageView.ScaleType scaleType) { ImageView imageView = new ImageView(context); imageView.setImageResource(placeholderResId); imageView.setClickable(true);//www .jav a 2 s .c o m imageView.setScaleType(scaleType); return imageView; }
From source file:Main.java
public static void addResourceImage(Activity activity, LinearLayout layout, int imgResource, int width, int height) { ImageView image = new ImageView(activity); image.setImageResource(imgResource); if (width > 0) image.setMaxWidth(width);//from ww w . ja va 2 s . co m if (height > 0) image.setMaxHeight(height); image.setScaleType(ImageView.ScaleType.CENTER_INSIDE); layout.addView(image); }
From source file:Main.java
public static void setIconInActionBar(ImageView imageButton, int Res) { imageButton.setVisibility(View.VISIBLE); imageButton.setImageResource(Res); }
From source file:Main.java
public static void setImagePictureFromBitmap(Context c, ImageView view, Bitmap bitmap, int notFoundResource) { if (bitmap == null) view.setImageResource(notFoundResource); view.setImageBitmap(bitmap);/* w w w. j a va 2 s .c o m*/ }
From source file:Main.java
private static void prepareUpDownVote(final ImageView imageView, final boolean isSet, final int setResId) { if (isSet) {/*ww w. j av a 2 s . c o m*/ imageView.setImageResource(setResId); } }
From source file:Main.java
public static void SetMenuAnimation(final ImageView v, final int bg1, final int bg2) { v.setImageResource(bg1); AlphaAnimation anim = new AlphaAnimation(0.8f, 1); anim.setDuration(1000);//from www .j a v a2s . c o m anim.setRepeatCount(Animation.INFINITE); // anim1.setRepeatMode(Animation.REVERSE); anim.setInterpolator(new AccelerateInterpolator()); anim.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation arg0) { // TODO Auto-generated method stub } @Override public void onAnimationRepeat(Animation arg0) { // TODO Auto-generated method stub num++; if (num == 10) { num = 0; } if (num % 2 == 0) { v.setImageResource(bg1); } else { v.setImageResource(bg2); } } @Override public void onAnimationEnd(Animation arg0) { // TODO Auto-generated method stub } }); v.startAnimation(anim); }
From source file:com.android.mail.utils.EmptyStateUtils.java
/** * Given an empty folder, set the corresponding empty state icon for that folder. *//*ww w . ja v a 2s . c o m*/ public static void bindEmptyFolderIcon(ImageView view, Folder folder) { if (folder == null) { view.setImageResource(R.drawable.ic_empty_default); } else if (folder.isInbox()) { view.setImageResource(R.drawable.ic_empty_inbox); } else if (folder.isSearch()) { view.setImageResource(R.drawable.ic_empty_search); } else if (folder.isSpam()) { view.setImageResource(R.drawable.ic_empty_spam); } else if (folder.isTrash()) { view.setImageResource(R.drawable.ic_empty_trash); } else { view.setImageResource(R.drawable.ic_empty_default); } }