question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request - CollapsingToolbarLayout: Allow multiple lines of text in expanded state

See original GitHub issue

Overview

CollapsingToolbarLayout currently only allows for a single line title. However, in the expanded state, there would be enough space to display multiple lines.

Multiple app developers (such as WhatsApp) have already built their own custom views as a replacement for CollapsingToolbarLayout to solve this issue. However, these are mostly closed-source, use different, inconsistent animations when expanding and collapsing, and/or are not usable as a drop-in replacement for CollapsingToolbarLayout because they have a different API.

We (@raphaelm and I, with help from some contributors) have built an open-source library that tries to solve this problem. It is based directly on the original CollapsingToolbarLayout/CollapsingTextHelper classes from the Design Support Library with only a few code changes and an additional maxLines attribute. In addition to that, we feel that the animation we use is more smooth than the one from e.g. WhatsApp.

Demo image

However, we had to copy quite a lot of files (basically all the classes that are referenced from CollapsingToolbarLayout) from the original support library when creating this library because they are package-private and therefore not accessible from our classes or because we needed access to private fields, which is not possible when extending a class. For this reason, it is quite tedious to keep our library up-to-date with changes from the support library.

Would you be interested in adopting our changes into the original library, e.g through a pull request? Or are you already working on the same feature?

There are some bugs in our library that occur when using text shadows or transparent text that we have not worked on ourselves because we don’t use those features in our app, but they should be quite straightforward to resolve.

Related issues

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:65
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

16reactions
PattaFeuFeucommented, Jun 18, 2019

What’s the current status on this one? The Material guidelines state that multiple lines should be used and that the code for Android was readily available, however it doesn’t feature this option.

image

2reactions
johan12345commented, Jan 16, 2020

@ArcherEmiya05 Not as far as I can see - the last change to CollapsingToolbarLayout in the library was 5 months ago. See the PR #413 for the latest updates.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How I can multiline the expanded title of ... - Stack Overflow
When collapsing the toolbar, the lower lines of the title fade away to leave only the top line visible. As the Design Support...
Read more >
Should allow multiline on title for expanded toolbar ...
Basically, Material guidelines state that multiple lines should be used on CollapsingToolbarLayouts when expanded, on the Title section of ...
Read more >
How To Multiline The Expanded Title Of ... - ADocLib
Overview. CollapsingToolbarLayout currently only allows for a single line title. However in the expanded state there would be enough space.
Read more >
Collapsing Toolbar made easy with Compose - Coding Troops
The toolbar is pretty simple as it contains an Image with a fixed size and a Column that holds the two Text Composables...
Read more >
Design Support Library (IV): Collapsing Toolbar Layout
Then we specify the contentScrim , which is the color the toolbar will take when it reaches it's collapsed state. I'll be changing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found