ImageView setAdjustViewBounds - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ImageView setAdjustViewBounds method.

This code example shows how to use the following methods: setLayoutParams, setPadding, setAdjustViewBounds, setImageResource, setScaleType
This code example shows how to use the following methods: setBackgroundResource, setLayoutParams, setAdjustViewBounds, setImageResource
        public long getItemId(int position) {
            return position;
        } 
 
        public View getView(final int position, View convertView, ViewGroup parent) {
            ImageView i = new ImageView(mContext);
 
            i.setImageResource(THUMB_IDS[position]);
            i.setAdjustViewBounds(true);
            i.setLayoutParams(new Gallery.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            i.setBackgroundResource(android.R.drawable.picture_frame);
            return i;
        } 
 
    } 
 
} 
 
     
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setAdjustViewBounds, setImageBitmap, setScaleType
		} 
	} 
 
	public void render( Context context ) {
		if ( imageView == null ) {
			imageView = new ImageView( context );
			imageView.setAdjustViewBounds( false );
			imageView.setScaleType( ImageView.ScaleType.MATRIX );
		}		 
		imageView.setImageBitmap( bitmap );
	} 
 
	public void destroy() { 
		if ( imageView != null ) {
			imageView.clearAnimation();
			imageView.setImageBitmap( null );
			ViewParent parent = imageView.getParent();
			if ( parent != null && parent instanceof ViewGroup ) {
				ViewGroup group = (ViewGroup) parent;
				group.removeView( imageView );
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setAdjustViewBounds, setScaleType
		} else { 
			if (viewWidthDefined && viewHeightDefined) {
				imageView.setAdjustViewBounds(false);
				imageView.setScaleType(ScaleType.FIT_XY);
			} else if (!enableScale) {
				imageView.setAdjustViewBounds(false);
				imageView.setScaleType(ScaleType.CENTER);
			} else { 
				imageView.setAdjustViewBounds(true);
				imageView.setScaleType(ScaleType.FIT_CENTER);
			} 
		} 
		requestLayout();
	} 
 
	public void setWidthDefined(boolean defined)
	{ 
		viewWidthDefined = defined;
		updateScaleType(); 
	} 
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setAdjustViewBounds, setImageBitmap, setScaleType
 
	} 
 
	public boolean render( Context context ) {
		if ( imageView == null ) {
			imageView = new ImageView( context );
			imageView.setAdjustViewBounds( false );
			imageView.setScaleType( ImageView.ScaleType.MATRIX );
		} 
		imageView.setImageBitmap( bitmap );
		return true; 
	} 
 
	public void destroy() { 
		if ( imageView != null ) {
			imageView.setImageBitmap( null );
			ViewParent parent = imageView.getParent();
			if ( parent != null && parent instanceof ViewGroup ) {
				ViewGroup group = (ViewGroup) parent;
				group.removeView( imageView );
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setLayoutParams, setAdjustViewBounds, setImageDrawable, setScaleType
  
		// if there is already a view don't recreate it 
		if (convertView != null) {
			myImageView = (ImageView) convertView;
		} else { 
			myImageView = new ImageView(mContext);
			myImageView.setLayoutParams(new GridView.LayoutParams(120, 120));
			myImageView.setAdjustViewBounds(false);
			myImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
		} 
 
		Bitmap bitmapImage = BitmapFactory.decodeFile(
				new File(collageDirectory, allFiles[position]).getPath());
 
		BitmapDrawable drawableImage = new BitmapDrawable(bitmapImage);
		myImageView.setImageDrawable(drawableImage);
 
		return myImageView;
	} 
 
	public static String getCollageDirectory() {
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setLayoutParams, setAdjustViewBounds, setImageDrawable
    public long getItemId(int position) {
      return position;
    } 
 
    public View getView(int position, View convertView, ViewGroup parent) {
      ImageView i = new ImageView(mContext);
      i.setImageDrawable(getDrawable(position));
      i.setAdjustViewBounds(true);
      i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT,
          LayoutParams.WRAP_CONTENT));
      return i;
    } 
 
    private Context mContext;
  } 
 
} 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setBackgroundColor, setId, setAdjustViewBounds, setImageResource, setScaleType
 
    @Override 
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
            imageView = new ImageButton(this.context);
            imageView.setId(buttonIds[position]);
            //imageButton.setLayoutParams(new GridView.LayoutParams(85, 85)); 
            imageView.setAdjustViewBounds(true);
            imageView.setBackgroundColor(Color.BLACK);
            imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
            //imageButton.setPadding(8, 8, 8, 8); 
        } else { 
            imageView = (ImageButton) convertView;
        } 
 
        imageView.setImageResource(cardImages[position]);
        return imageView;
 
    } 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setAdjustViewBounds, setMaxHeight, setMaxWidth
	/* 
	 * Initiate class object and sets global parameters 
	 */ 
	public VideoThread(ImageView display) throws SocketException {
		receiver = new Receiver(8656);
		display.setAdjustViewBounds(true);
		display.setMaxHeight(320);
		display.setMaxWidth(480);
		this.display = display;
		flag = false;
	} 
	 
	/* 
	 * Stops video thread 
	 */ 
	public void stop() { 
		flag = false;
		if(receiver != null)
			receiver.close();
		receiver = null;
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setBackgroundDrawable, setClickable, setFocusable, setLayoutParams, setPadding
        public View getView(int position, View convertView, ViewGroup parent)
        { 
            ImageButton imageButton;
            if (convertView == null)
            {  // if it's not recycled, initialize some attributes 
                imageButton = new ImageButton(mContext);
                imageButton.setLayoutParams(new GridView.LayoutParams(150,150));
                imageButton.setScaleType(ImageButton.ScaleType.CENTER_CROP);
                imageButton.setPadding(7, 8, 7, 8);
                imageButton.setAdjustViewBounds(true);
 
                Drawable d;
                d = Drawable.createFromPath(mThumbIds[position].toString());
                imageButton.setBackgroundDrawable(d);
            } 
            else 
            { 
                imageButton = (ImageButton) convertView;
            } 
 

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related ImageView setAdjustViewBounds Questions & Answers:

setAdjustViewBounds Method Overview
Set this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable.
See Code Examples for other Android ImageView Methods: