Home > DeveloperSection > Forums > Captured images using camera to fit into a Imageview of fixed height and width
john rob

Total Post:108

Points:756
Posted on    October-19-2014 11:47 PM

 Android Android  Android Styles 
Ratings:


 2 Reply(s)
 1594  View(s)
Rate this:
Hi i have followed android developer site and tried to implement capture an image from camera programatically. I am able to capture the image and set it in the ImageView. 
But when I am setting the image into the ImageView i am getting an image of less width and height. Instead i want the image captured from gallery 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="openCameraDialog"

    />

Since i have given the width as match_parent which is full screen I am getting less width. My requirement is like it should fit the ImageView layout. For camera coding I have followed this url:

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




Jeet Verma
Jeet Verma

Total Post:110

Points:776
Supported
Posted on    October-19-2014 11:50 PM

Try this

 android:scaleType="fitXY"
to your imageview inside xml file.

Manoj Bhatt
Manoj Bhatt

Total Post:153

Points:1079
Posted on    October-19-2014 11:52 PM

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"

    />


Don't want to miss updates? Please click the below button!

Follow MindStick