FadingActionBar
FadingActionBar copied to clipboard
Load header image from Picasso before setting layout
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
Did you found solution for this issue?
Nope.
Any workaround?
@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.
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);
You can disable parallax to keep the layout aligned
Just append
.parallax(false);
to the FadingActionBarHelper