Skip to content

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

@johan12345

Description

@johan12345

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions