List of usage examples for android.widget ImageView ImageView
public ImageView(Context context)
From source file:Main.java
public static ImageView createImageViewFromBitmap(Context context, Bitmap bitmap) { ImageView imageView = new ImageView(context); imageView.setScaleType(ScaleType.FIT_XY); imageView.setImageBitmap(bitmap);//from w w w .ja v a2 s . c o m return imageView; }
From source file:Main.java
public static View getView(int width, Context mContext) { // Make an ImageView to show a photo ImageView i = new ImageView(mContext); i.setAdjustViewBounds(true);// w w w . j av a 2 s . co m i.setLayoutParams(new AbsListView.LayoutParams(width, AbsListView.LayoutParams.WRAP_CONTENT)); // Give it a nice background //i.setBackgroundResource(R.drawable.picture_frame); return i; }
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 www.j av a 2 s. c o m if (height > 0) image.setMaxHeight(height); image.setScaleType(ImageView.ScaleType.CENTER_INSIDE); layout.addView(image); }
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);/*from w w w .j a va 2s . c o m*/ imageView.setScaleType(scaleType); return imageView; }
From source file:Main.java
public static void showPopWindow(Context context, View parent, int drawableId) { if (drawableId == 0) { return;//from w w w . ja v a 2 s .c o m } if (pop == null) { ImageView imageView = null; imageView = new ImageView(context); imageView.setBackgroundResource(drawableId); pop = new PopupWindow(imageView, LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); imageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (pop != null) { pop.dismiss(); pop = null; } } }); } if (!pop.isShowing()) { pop.showAtLocation(parent, Gravity.BOTTOM, 0, 0); } }
From source file:Main.java
private static ImageView newStar(Activity activity, int drawableResId) { ImageView star = new ImageView(activity); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); star.setLayoutParams(params);/* ww w .j av a 2 s . c om*/ star.setImageResource(drawableResId); return star; }
From source file:Main.java
public static void startActivity(final Activity thisActivity, final Intent intent, final View triggerView, int colorOrImageRes, final long durationMills) { int[] location = new int[2]; triggerView.getLocationInWindow(location); final int cx = location[0] + triggerView.getWidth(); final int cy = location[1] + triggerView.getHeight() + (int) TypedValue .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 160, thisActivity.getResources().getDisplayMetrics()); final ImageView view = new ImageView(thisActivity); view.setScaleType(ImageView.ScaleType.CENTER_CROP); view.setImageResource(colorOrImageRes); final ViewGroup decorView = (ViewGroup) thisActivity.getWindow().getDecorView(); int w = decorView.getWidth(); int h = decorView.getHeight(); decorView.addView(view, w, h);// w ww . ja v a 2s . c om final int finalRadius = (int) Math.sqrt(w * w + h * h) + 1; Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius); anim.setDuration(durationMills); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); thisActivity.startActivity(intent); thisActivity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } }); anim.start(); }
From source file:com.mattermost.service.Promise.java
public static PopupWindow show() { Activity currentActivity = AppActivity.current; PopupWindow pw = new PopupWindow(currentActivity); pw.setFocusable(false);//from w w w . j a va 2 s .c o m pw.setBackgroundDrawable(new ColorDrawable(0)); ImageView img = new ImageView(currentActivity); pw.setContentView(img); View view = currentActivity.getWindow().getDecorView(); pw.setWidth(60); pw.setHeight(60); AnimatedCircleDrawable a = new AnimatedCircleDrawable(Color.RED, 5, Color.TRANSPARENT, 30); img.setImageDrawable(a); pw.showAtLocation(view, Gravity.LEFT | Gravity.TOP, view.getWidth() / 2 - 30, view.getHeight() / 2 - 30); a.start(); return pw; }
From source file:com.maxleap.mall.adapters.ProductGalleryAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { ImageView imageView = new ImageView(mContext); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); String imgUrl = mPics.get(position); Picasso.with(mContext).load(imgUrl).into(imageView); container.addView(imageView);/*from w w w .j a v a 2 s . c om*/ return imageView; }
From source file:com.commonsware.android.preso.decktastic.SlidesAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { ImageView page = new ImageView(ctxt); ViewGroup.LayoutParams p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); container.addView(page, p);//from www . ja v a 2 s.c o m Picasso.with(ctxt).load(getSlideImageUri(position)).into(page); return (page); }