Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Self-Destructing Message Android App Retrieving and Viewing Messages Using Picasso to View Images from the Web

Why is the picture so shrink and is there way to make that image full size like snapchat ?

i am just curious how to make the image full size so there is no left out space..

2 Answers

Fabian Gmeiner
Fabian Gmeiner
6,574 Points

Yes, if your screen has a size of 1980 by 1024 and you tell Picasso to resize the image to this size, there wont be any space left (Assuming the ActionBar & StatusBar is not present).

This works both ways, upscaling and downscaling a picture.

Fabian Gmeiner
Fabian Gmeiner
6,574 Points

Do you want the image to be the size of your view or a fullscreen-activity, too ? For a fullscreen-activity, use the following in your styles.xml:

        <style name="<your name>" parent="android:Theme.Material.NoActionBar.Fullscreen"/>

For displaying your image on the whole screen, make sure your layout and imageView has no paddings/margins at all and width/height set to match_parent.

Picasso gives you the option to resize the loaded image to suit your needs. For Example:

       Picasso.with(context).load(Url).resize(width, height).into(ImageView);

Note that Picasso takes actual pixel-values here, not dp-ones.

To get your displays dimensions you can use Androids WindowManager (when in an Activity)

    Display display = getWindowManager().getDefaultDisplay();
    Point screenSize = new Point();
    display.getSize(screenSize);  // the values are saved in the screenSize object
    int width = screenSize.x;
    int height = screenSize.y;

For further informations, take a look at this post

I hope this works for you.

Best regards, Fabian

Ok, so would this make picture stretch or fit XY so it won't have white space on the top and on the bottom