Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8025871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:18:29+00:00 2026-06-04T23:18:29+00:00

How do I fit an image to the screen captured from the camera? I

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:18:31+00:00Added an answer on June 4, 2026 at 11:18 pm

    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 ) :

    1. 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 .

    2. 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.

    3. 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”) :

    ...
    final View view=findViewById(R.id.view1);
    final WindowManager.LayoutParams layoutParams=new WindowManager.LayoutParams();
    layoutParams.gravity=Gravity.TOP|Gravity.LEFT;
    layoutParams.width=view.getLayoutParams().width;
    layoutParams.height=view.getLayoutParams().height;
    layoutParams.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
    layoutParams.flags|=WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
    final ViewGroup parent=(ViewGroup)view.getParent();
    parent.removeView(view);
    final WindowManager windowManager=(WindowManager)getSystemService(Context.WINDOW_SERVICE);
    windowManager.addView(view,layoutParams);
    // TODO handle overlapping title bar and/or action bar if needed
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some layout with image, I want that layout fit in screen automatically
I have method that download and resize image according to screen size to fit
I have a background image being stretched to fit the entire screen. I am
I have a image of a shelf that I want to expand and contract
It's possible to write CSS that stretches a container's background image to fit the
I have a website where the background image is stretched to fit the entire
I have 6 images sized 50x50 that are supposed to fit in a 300px
Unable to correctly perform the simplest task - fit image to screen. Pictures loads
I have a screen with a background image and two buttons at the bottom.
I have problem with displaying bitmap image on imageview on high density screen (480x800).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.