Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Align background with expanded text #35

Open
dmfs opened this issue Apr 3, 2017 · 3 comments
Open

Align background with expanded text #35

dmfs opened this issue Apr 3, 2017 · 3 comments

Comments

@dmfs
Copy link

dmfs commented Apr 3, 2017

How can I add a background shape/color and align it with the expanded title like so?
screenshot_1491245756
The goal is that the background expands/shrinks with the title.

@raphaelm
Copy link
Member

raphaelm commented Apr 6, 2017

Isn't this a standard feature of collapsing toolbar? I'm not an expert here. How is this related to our library?

@johan12345
Copy link
Contributor

@raphaelm I think he is talking about the gray overlay behind the text. That's not a standard feature of the collapsing toolbar.

It would probably be possible to create such a background with a fixed height (using a semi-transparent view inside the CollapsingToolbarLayout). But if you want the height to adapt to the text height (also during the animation between collapsed and expanded states), the easiest way is probably to directly look at the drawing code.
At CollapsingTextHelper.java:553, there's some code that draws a rectangle behind the text used for debugging. Probably that could be adapted to your use case.

@dmfs
Copy link
Author

dmfs commented Apr 6, 2017

@johan12345 yes, that's what I meant. Since the text doesn't have a fixed height, it's not possible to align it with any existing view.

I'll check out the code you referred to. Maybe I can build something generic to align any existing view with the text

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

No branches or pull requests

3 participants