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

Headers are displayed underneath the regular cards #48

Closed
GoodSir42 opened this issue Mar 3, 2015 · 14 comments
Closed

Headers are displayed underneath the regular cards #48

GoodSir42 opened this issue Mar 3, 2015 · 14 comments

Comments

@GoodSir42
Copy link

Hi again!

I found another issue: Sticky headers are somehow displayed below my cards. this may have something to do with the elevation level of a card on Android 5, but I am really not sure.. Could you have a look at it and make sure that headers are always on top? (telling me what may be wrong is also an option ;) )
screenshot_2015-03-03-09-26-23

@TonicArtos
Copy link
Owner

Please tell me which version of SuperSLiM you are using. Thanks.

@GoodSir42
Copy link
Author

0.4.1

@TonicArtos
Copy link
Owner

Okay thanks, I was hoping it was margins related. I wonder if it is caused by the child index ordering? I don't know much about how Android 5 does its elevation trick.

@GoodSir42
Copy link
Author

I guess it's because the cards get an elevation property which makes them display with a shadow... I was hoping this did not affect the headers, but apparently I have to solve this myself then (as it's not necessarily related to your framework).

@TonicArtos
Copy link
Owner

Well, it looks like the cards are intruding on the headers layout. I thought the cards should have margins to prevent that. I am going to take a look at it, but as far as I am aware, I've done everything I should to properly measure and layout views.

@GoodSir42
Copy link
Author

Indeed, the layout is perfectly fine, but the sticky headers slip under the cards while scrolling.

@TonicArtos
Copy link
Owner

Oh, I understand now. Things are fine until the headers are in their stickied state. This makes perfect sense since elevation in android 5 changes the drawing order.

I don't see why SuperSLiM shouldn't be able to handle this. What do you think of these ideas.

  1. You can set a listener for when headers are stickied. This would give you the view and perform operations on it.

  2. SuperSLiM offers configuration options to automatically adjust a headers elevation for the stickied state.

@GoodSir42
Copy link
Author

The second one sounds perfect, but the first will also allow some workarounds. Although I guess I am getting a shadow if the elevation is changed, so changing the drawing order may be more reasonable. I can't imagine any reason why a sticky header should not always be on top.

@TonicArtos
Copy link
Owner

I am not sure I can override the drawing order. Also, in my understanding of the material design spec, the headers should probably get elevation and shadow if content is to pass underneath.

You can disable the shadows using setOutlineProvider(null) on the header views. Maybe this could also be done automatically per the LayoutManager configuration.

@GoodSir42
Copy link
Author

Hm.. sounds good, I will give it a try.

@TonicArtos
Copy link
Owner

Cool, tell me how it goes.

@TonicArtos
Copy link
Owner

Here is a detailed look at the solution.

https://github.com/TonicArtos/SuperSLiM/wiki/Sticky-elevation-proposal

@GoodSir42
Copy link
Author

My first results: setting an elevation works perfectly fine. A card has a default elevation of 2dp (which is the minimum value for the header then).

If I set teh outline provider to null I get no shadow. I think you don't really have to take a specific action for this, just leave this post as a documentation and link to it.

@TonicArtos
Copy link
Owner

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants