---
title: "Configure ImageView to display subrect of bitmap in Android"  
description: "Configure ImageView to display subrect of bitmap in Android"  
author: "Mark M"  
published: 2014-11-07  
updated: 2014-11-07  
canonical: https://www.mindstick.com/forum/2539/configure-imageview-to-display-subrect-of-bitmap-in-android  
category: "android"  
tags: ["image view"]  
reading_time: 1 minute  

---

# Configure ImageView to display subrect of bitmap in Android

Hi Guys

I have a [view](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view) that contains an **[ImageView](https://www.mindstick.com/forum/34664/how-to-set-an-image-on-imageview-in-android)**. The ImageView is populated with a png [resource](https://www.mindstick.com/blog/43433/top-best-resources-for-women-about-beauty-and-health), and fills the [width and height](https://www.mindstick.com/forum/158680/what-css-property-is-used-to-set-the-width-and-height-of-an-element) of the [image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) view.

Instead of this [configuration](https://www.mindstick.com/articles/13112/setting-up-the-perfect-configuration-for-your-work-computer), I would like to display the image zoomed in by an arbitrary percentage, and translated by an arbitrary coordinate. My [question](https://www.mindstick.com/blog/23175/how-to-solve-neet-question-paper-in-less-time) is, how can I configure an image view to display a sub-[region](https://www.mindstick.com/forum/158172/what-is-the-dholera-special-investment-region-in-gujarat) of it's src [bitmap](https://www.mindstick.com/forum/1924/find-image-format-using-bitmap-object-in-c-sharp), with arbitrary [translation](https://www.mindstick.com/articles/85548/translation-technologies-and-techniques)?

I would really appreciate your help.

Thanks

## Replies

### Reply by Anonymous User

You can do this with matrix scaleType

1-Make a ImageView to have matrix scaleType, android:scaleType="matrix"

2-Create and manipulate a Matrix like this,

`Matrix matrix = new Matrix();`\
`matrix.postTranslate(-10, -10);`\
`matrix.postScale(2, 2);`

3-set this matrix to ImageView, imageView.setImageMatrix(matrix)\


---

Original Source: https://www.mindstick.com/forum/2539/configure-imageview-to-display-subrect-of-bitmap-in-android

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
