In the Design Support Library (V 22.2.0), I am having issues setting the expandedTitleTextAppearance and collapsedTitleTextAppearance properties of the CollapsingToolbarLayout .
For example if I set it like this:
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:expandedTitleTextAppearance="@style/TransparentText"
>
and the styles look like this:
<style name="TransparentText">
<item name="android:textColor">#00000000</item>
</style>
<style name="GreyText">
<item name="android:textColor">#666666</item>
</style>
The text does not show but when I try to expand the toolbar after it collapses the app will crash on Android 4.1 .
And if I set it to this:
app:expandedTitleTextAppearance="@style/TransparentText"
app:collapsedTitleTextAppearance="@style/GreyText"
It no longer crashes but the text does not show when it collapses.
It looks like the styles used for setting expandedTitleTextAppearance and collapsedTitleTextAppearance must extend from TextAppearance.
So everything will work properly if the styles are changed to this:
<style name="TransparentText" parent="@android:style/TextAppearance">
<item name="android:textColor">#00000000</item>
</style>
<style name="GreyText" parent="@android:style/TextAppearance">
<item name="android:textColor">#666666</item>
</style>
By the way, since TextView works properly when you set android:TextAppearance without explicitly extending @android:style/TextAppearance, I have logged this as a bug: https://code.google.com/p/android/issues/detail?id=178674
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With