Closed Angels-group closed 6 years ago
How does this look like in the collapsed state? I suspect that the reason for the third line is that with only two lines, the second line would be longer than the (proportionally scaled) space that is available for the first line in the collapsed state.
Is there no way to do the first line of width to move to the Toolbar, and the remaining lines do more (like match_parent)?
Well, that would probably be quite difficult, as Android's text layout classes are only designed for text in a rectangular frame, not with different widths for each line. Also it would probably look quite strange when the first line is shorter than the other ones.
Another possibility would be to make all lines (including the first one) match the width of the toolbar, but that would mean that during the transition between collapsed and expanded state, part of the text would appear behind the toolbar buttons, which also doesn't look great.
Hmmm, it might also be that this is related to #26 and therefore might get fixed by #46 .
I have some idea - may be it is possible to use two textLayouts (StaticLayout mTextLayout1 and StaticLayout mTextLayout2). First, the given title (mText) is measured and divided into 2 parts. mTextLayout1 - has a length that can fit to toolbar in a collapsed state (red is screenshot) mTextLayout2 - all that is left and what will be hidden and what you can see in expanded state (green in screenshot)
I do not fully understand how this library works, so my guesswork may not be true. I apologize in advance.
Thank you very much for the library! I have a question - why is a new line created in Title (the third)? Visually, the header could fit into 2 lines.![screenshot_2](https://user-images.githubusercontent.com/1552042/33140218-66230e08-cfc0-11e7-8e01-31dcde72b340.png)
My xml insert:
<net.opacapp.multilinecollapsingtoolbar.CollapsingToolbarLayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" app:contentScrim="?attr/colorPrimaryDark" app:expandedTitleGravity="bottom" app:expandedTitleMarginBottom="0dp" app:expandedTitleMarginStart="16dp" app:expandedTitleTextAppearance="@style/collapsingTitle" app:maxLines="3" app:expandedTitleMarginEnd="0dp" app:layout_scrollFlags="scroll|exitUntilCollapsed">