FadingActionBar icon indicating copy to clipboard operation
FadingActionBar copied to clipboard

Load header image from Picasso before setting layout

Open JasonAndujar opened this issue 10 years ago • 6 comments

Whenever I load the layout and then use Picasso to load the image, the layout is misplaced (http://imgur.com/CDAm11w), is there any way to load the image FIRST then add the content layout? Thanks

JasonAndujar avatar Apr 25 '14 16:04 JasonAndujar

Did you found solution for this issue?

pauloandreget avatar May 18 '14 11:05 pauloandreget

Nope.

JasonAndujar avatar May 18 '14 12:05 JasonAndujar

Any workaround?

MiguelCatalan avatar Jun 23 '14 11:06 MiguelCatalan

@MiguelCatalan Unfortunately no, but I have an idea. Setting the image height and width to the screen and then calling center crop using the Picasso library will set the image to fit the width of the screen of the device and keep aspect ratio, so in theory this should work. I have had no time to test, but it worked great with a static image so it's worth a shot.

JasonAndujar avatar Jun 25 '14 12:06 JasonAndujar

Try to set the Imageview´s height before loading Picaso. Something like this:

FadingActionBarHelper helper = new FadingActionBarHelper() ... .... helper.initActionBar(this); .... actionBarHeaderIv.getLayoutParams().height = 480; Picasso.with(this).load(IMAGE_URI).resize(width, 480).centerCrop().into(actionBarHeaderIv);

reappciona avatar Mar 06 '15 16:03 reappciona

You can disable parallax to keep the layout aligned

Just append

.parallax(false);

to the FadingActionBarHelper

mikylucky avatar Jan 29 '16 22:01 mikylucky