How do I fit an image to the screen captured from the camera? I currently have a preview that is a sort of thumbnail version of the image taken. I want to touch it and fit it to the whole screen. In the layout, I have the property:
android:onClick="previewPhoto"
But I don't know how to proceed. Here is what I think I should do, but wonder if there is a simpler way. If I go with starting a new activity, how should I finish the following code?
public void previewPhoto(View view){
Toast.makeText(this, "Photo touched!", Toast.LENGTH_SHORT).show();
mImageView.setScaleType(ScaleType.FIT_XY);
Intent fullScreenIntent = new Intent(view.getContext(),FullImageActivity.class);
fullScreenIntent.putExtra
//ProfilePageNormalUser.this.startActivity(fullScreenIntent);
}
Note that mImageView is an object that holds the photo captured. When I simply use setScaleType(ScaleType.FIT_XY);
it will fit the image to the tiny thumbnail view.
3 possible solutions , but for all of them , you need to set a new layoutParams for the view (for both width and height , set them to fillParent ) :
use "setContentView" on the imageView to use it as the new layout . when done , go back to the previous layout by using this method on the layout that you used .
it needs to take over the entire space of the root view . this solution depends on the layout of the activity . for example , if the layout is complex , wrap it in a framelayout , and move the view to the framelayout and then set the layoutParams.
set the view to be on top of all of the views , and then set the layoutParams.example (in the example , the "view" is the one that you wish to set on top , for you , this would be "mImageView") :