CollapsingToolbarLayout
uses a helper class - CollapsingTextHelper
- to draw and animate its name. At the time of writing, the latest versions of this class limit the available width of the extended header to a size based on the width available in the minimized state, scalable by the ratio of the sizes of the text of the states.
Relevant source comments:
This, apparently, was introduced to address some cases of edges where the title would overlap other things of the Toolbar
, as described in the notes for the corresponding commit .
Fix CollapsingToolbarLayout show above icons
CTL scales the header, which works in most situations. There are edge cases, although the name can be drawn on the contents of the Toolbar, namely the icons.
This CL captures boundary cases where collapsed and expanded text sizes are similar in size, which means that there is limited / no scaling when scrolling. In this case, we need any available width when expanding, so that it โscalesโ to coincide with the collapsed width when changing.
As a rule, Iโm all about breaking into View
classes in order to change their behavior with reflection and other tricks, but in this case this setting is such that it takes some really hard climb. The helper class is usually not available outside the library package, its instance is private in CollapsingToolbarLayout
, and calibration calculations are performed in a private, secondary method with predominantly local variables.
If possible, the easiest solution would be to revert to the version of the library published before this fix. I have not determined the exact version that brought this change, and the history of changes in the support library does not seem to mention it, unfortunately. However, this commission was made in the middle of last year (2016), therefore, probably around version 24.0.0 or a little later. I can check for behavior in 23.4.0.
You could write an error report for this if you want, although you did not guarantee that they would consider it an error. I have not found previously asked questions regarding this, other than this tangent related to it , complaining of ellipsis, which was a side effect that are changing.