Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve LayoutParams of header layout to enable setting a specific height #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hdodenhof
Copy link

Currently a layout_height for a header image set in the header layout resource is being ignored.

Consider the following example:

<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="250dp"
    android:scaleType="centerCrop"
    android:src="@drawable/foobar"/>

With that I would expect the header image to have an exact height of 250dp but it doesn't. It seems the actual height just depends on the drawable and probably the ScaleType.

With this change the LayoutParams of the header layout are being kept when inflating to avoid this behavior.

@ghost
Copy link

ghost commented Jan 26, 2014

That's exactly the issue i'm now facing..

I tried it with your code, does not seem to work for me ..

Still displays full image size instead of defined in layout_height

@hdodenhof
Copy link
Author

Are you using headerLayout(int layoutResId) or headerView(View view) to add the header? The provided fix does only work for the former.

@ghost
Copy link

ghost commented Jan 27, 2014

So I added the header with headerView, cleaned the project, but still the size is the image size..

and then

FadingActionBarHelper helper = new FadingActionBarHelper()
.actionBarBackground(R.drawable.ab_solid_goodstudent)
.lightActionBar(false).headerView(headerview).headerOverlayLayout(R.layout.datepager)
.parallax(true)
.contentLayout(R.layout.activity_timeline);

Still no change..

@hdodenhof
Copy link
Author

It actually only works with headerLayout(int layoutResId), as said before. If that's how you did it in the first place, I'm not sure what's going wrong. I just verified that this works with all the included samples, which should cover most cases.

Try building the samples from my fork after adjusting each header.xml and look for differences to your implementation.

@ghost
Copy link

ghost commented Jan 28, 2014

It's now working, I really don't know why, I really did not change anything then..

Very weird, but I'm very thankful for your fix!

Dankeschöön

@ChrisMCMine
Copy link

+1, @ManuelPeinado merge this pull request please

@reixa00
Copy link

reixa00 commented Sep 17, 2014

Could be great to add this merge, I´m now facing the same problems as they did. By the way, the merged fix works like a charm.

Arnix added a commit to comoyo/FadingActionBar that referenced this pull request Oct 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants