List of usage examples for android.widget ImageView setScaleType
public void setScaleType(ScaleType scaleType)
From source file:com.manning.androidhacks.hack028.adapter.ImageAdapter.java
public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView = new ImageView(mContext); imageView.setImageResource(mImageIds[position]); imageView.setLayoutParams(new Gallery.LayoutParams(150, 100)); imageView.setScaleType(ImageView.ScaleType.FIT_XY); return imageView; }
From source file:com.microsoft.assetmanagement.adapters.DisplayCarAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { CarListViewItem item = mData.get(position); ImageView imageView = null; byte[] picture = item.getPicture(); imageView = new ImageView(mActivity); try {/* ww w . java2 s .c o m*/ imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); imageView.setImageBitmap(mResizer.getBitmapFrom(picture)); ((ViewPager) container).addView(imageView, 0); } catch (Exception e) { Log.e("Asset", e.getMessage()); } return imageView; }
From source file:us.nineworlds.serenity.volley.YouTubeTrailerSearchResponseListener.java
@Override public void onResponse(JSONObject response) { try {//from www . j a va 2 s.c om JSONArray items = response.getJSONArray("items"); View trailerIndicator = posterView.findViewById(R.id.trailerIndicator); View infoGraphicMeta = posterView.findViewById(R.id.infoGraphicMeta); JSONObject item = items.getJSONObject(0); JSONObject youtubeId = item.getJSONObject("id"); String id = youtubeId.getString("videoId"); createMetaData(id); if (trailerIndicator != null) { trailerIndicator.setVisibility(View.VISIBLE); infoGraphicMeta.setVisibility(View.VISIBLE); } else { Activity context = (Activity) posterView.getContext(); LinearLayout infographicsView = (LinearLayout) context.findViewById(R.id.movieInfoGraphicLayout); ImageView ytImage = new ImageView(context); ytImage.setImageResource(R.drawable.yt_social_icon_red_128px); ytImage.setScaleType(ScaleType.FIT_XY); int w = ImageUtils.getDPI(45, context); int h = ImageUtils.getDPI(24, context); ytImage.setLayoutParams(new LinearLayout.LayoutParams(w, h)); LinearLayout.LayoutParams p = (LinearLayout.LayoutParams) ytImage.getLayoutParams(); p.leftMargin = 5; p.gravity = Gravity.CENTER_VERTICAL; infographicsView.addView(ytImage); } video.setTrailer(true); video.setTrailerId(id); } catch (JSONException e) { Log.d(getClass().getName(), e.getMessage(), e); } }
From source file:com.manning.androidhacks.hack008.MainActivity.java
private ImageView createNewView() { ImageView ret = new ImageView(this); ret.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); ret.setScaleType(ScaleType.FIT_XY); ret.setImageResource(PHOTOS[mIndex]); mIndex = (mIndex + 1 < PHOTOS.length) ? mIndex + 1 : 0; return ret;//from w ww . j a v a 2 s . c om }
From source file:net.evecom.androidecssp.activity.EmergencyNotification.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.emergency_info_activity); //1/*from w w w.j a v a 2 s . co m*/ viewpager = (ViewPager) findViewById(R.id.my_viewpager_id); //4DepthPageTransformer // viewpager.setPageTransformer(true, new DepthPageTransformer()); viewpager.setPageTransformer(true, new RotateDownTransformer()); //2 viewpager.setAdapter(new PagerAdapter() { @Override //item page public Object instantiateItem(ViewGroup container, int position) { // switchpage ImageView imageView = new ImageView(EmergencyNotification.this); imageView.setImageResource(imagesId[position]); // imageView.setScaleType(ScaleType.CENTER_CROP); //imageViewcontainer page container.addView(imageView); //imageViewlist imageViews.add(imageView); //imageView return imageView; } @Override //destroyItem public void destroyItem(ViewGroup container, int position, Object object) { container.removeView(imageViews.get(position)); } @Override // adapter public boolean isViewFromObject(View view, Object object) { return view == object; } @Override // public int getCount() { return imagesId.length; } }); }
From source file:com.facebook.notifications.internal.asset.handlers.BitmapAssetHandler.java
@NonNull @Override//from w ww . jav a 2s. co m public View createView(@NonNull BitmapAsset asset, @NonNull Context context) { ImageView imageView = new ImageView(context); imageView.setImageBitmap(asset.getBitmap()); imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); imageView.setAdjustViewBounds(true); return imageView; }
From source file:com.zhongsou.souyue.adapter.GalleryNewsPagerAdapter.java
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { ImageView v = (ImageView) view; v.setScaleType(ImageView.ScaleType.CENTER); }
From source file:com.zhongsou.souyue.adapter.GalleryNewsPagerAdapter.java
@Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { ImageView v = (ImageView) view; v.setScaleType(ImageView.ScaleType.CENTER_CROP); }
From source file:com.zhongsou.souyue.adapter.GalleryNewsPagerAdapter.java
@Override public void onLoadingStarted(String imageUri, View view) { ImageView v = (ImageView) view; v.setScaleType(ImageView.ScaleType.CENTER); }
From source file:it.configure.imageloader.zoom.PhotoViewAttacher.java
/** * Set's the ImageView's ScaleType to Matrix. *///from w ww. ja v a 2 s .c o m private static void setImageViewScaleTypeMatrix(ImageView imageView) { if (null != imageView) { if (imageView instanceof PhotoView) { /** * PhotoView sets it's own ScaleType to Matrix, then diverts all * calls setScaleType to this.setScaleType. Basically we don't * need to do anything here */ } else { imageView.setScaleType(ScaleType.MATRIX); } } }