Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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