---
title: "Captured images using camera to fit into a Imageview of fixed height and width"  
description: "Captured images using camera to fit into a Imageview of fixed height and width"  
author: "Anonymous User"  
published: 2014-10-19  
updated: 2014-10-19  
canonical: https://www.mindstick.com/forum/2419/captured-images-using-camera-to-fit-into-a-imageview-of-fixed-height-and-width  
category: "android"  
tags: ["android", "android styles"]  
reading_time: 1 minute  

---

# Captured images using camera to fit into a Imageview of fixed height and width

Hi i have followed [android](https://www.mindstick.com/articles/13046/10-reasons-why-i-prefer-android-vs-iphone-ios) [developer](https://www.mindstick.com/articles/157260/variation-between-web-designer-and-web-developer) site and tried to implement [capture](https://answers.mindstick.com/qa/30907/which-phone-is-better-between-billion-capture-plus-and-xiaomi-mi-a1-and-moto-g5s-plus) an image from camera programatically. I am able to capture the image and set it in the [ImageView](https://www.mindstick.com/forum/34664/how-to-set-an-image-on-imageview-in-android). \
But when I am setting the image into the ImageView i [am getting](https://www.mindstick.com/forum/34179/i-am-getting-error-while-assigning-the-data-to-the-array-list) an image of less [width and height](https://www.mindstick.com/forum/158680/what-css-property-is-used-to-set-the-width-and-height-of-an-element). Instead i want the image captured from [gallery](https://answers.mindstick.com/qa/31021/how-do-i-style-a-gallery-wall) or camera should fit into the ImageView element layout. \
MyXML file is like as follows:\

<ImageView

android:id="@+id/cmp_camera"

android:layout_height="200dp"

android:layout_width="match_parent"

android:layout_weight="1"

android:layout_below="@+id/cmp_title"

android:[onClick](https://www.mindstick.com/forum/12718/onclick-for-hyperlink)="openCameraDialog"

/>

Since i have given the width as match_parent which is full screen I am getting less width. My [requirement](https://yourviews.mindstick.com/view/85169/becoming-an-influencer-requirement-of-skills-and-knowledge) is like it should fit the ImageView layout. For camera [coding](https://www.mindstick.com/articles/12290/teaching-coding-from-the-metal-up-or-from-the-glass-back) I have followed this url:

http://developer.android.com/training/camera/photobasics.html

\

## Replies

### Reply by Manoj Bhatt

ImageView.setImageBitmap(bitmap);

<ImageView

android:id="@+id/cmp_camera"

android:layout_height="200dp"

android:layout_width="match_parent"

android:layout_weight="1"

android:layout_below="@+id/cmp_title"

android:onClick="openCameraDialog"

android:scaleType="fitXY"

/>

### Reply by Anonymous User

Try this\
android:scaleType="fitXY"to your imageview inside xml file.


---

Original Source: https://www.mindstick.com/forum/2419/captured-images-using-camera-to-fit-into-a-imageview-of-fixed-height-and-width

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
