大佬教程收集整理的这篇文章主要介绍了android – CollapsingToolbarLayout:setShadowLayer,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
展开时看起来像这样:
半坍塌时看起来像这样:
您可以看到白色文本在扩展模式下与背景图像不能很好地协同工作.
通常为了提高文本的清晰度,如果这是一个textview,我通常会设置ShadowLayer:http://developer.android.com/reference/android/widget/TextView.html#setShadowLayer(float,%20int)
在这种情况下,因为它是一个collapsingToolbarLayout,它不是textview,所以看起来该方法不可用于在文本后面设置阴影.
有没有人知道一种方法可以增加collapsingToolbarLayout中文本的澄清,例如可能在collapsingToolbarLayout中@L_616_14@文本或@L_616_14@阴影?
Android CollapsingToolbarLayout Title background
用户实际上问了一个非常相似的问题,答案是使用一个非常好用的文本保护稀松布.
使用文本保护稀松布(向下滚动一下).我的示例假设标题文本为白色,因此可能需要进行一些调整以优化您的案例.
在您的CollapsingToolbarLayout中,在ivBigImage之后@L_616_14@以下@L_944_25@:
<View android:layout_width="match_parent" android:layout_height="@dimen/sheet_text_scrim_height_top" android:BACkground="@drawable/scrim_top" app:layout_collapseMode="pin"/> <View android:layout_width="match_parent" android:layout_height="@dimen/sheet_text_scrim_heighT_Bottom" android:layout_gravity="bottom" android:layout_alignBottom="@+id/image" android:BACkground="@drawable/scrim_bottom"/>
scrim_top.xml
<shape xmlns:android="http://scheR_694_11845@as.android.com/apk/res/android"> <gradient android:angle="270" android:startColor="@color/translucent_scrim_top" android:centerColor="@color/translucent_scrim_top_center" android:endColor="@android:color/transparent"/> </shape>
和scrim_bottom.xml
<shape xmlns:android="http://scheR_694_11845@as.android.com/apk/res/android"> <gradient android:angle="90" android:startColor="@color/translucent_scrim_bottom" android:centerColor="@color/translucent_scrim_bottom_center" android:endColor="@android:color/transparent"/> </shape>
对于颜色,我用过:
<color name="translucent_scrim_top">#26000000</color> <color name="translucent_scrim_top_center">#0C000000</color> <color name="translucent_scrim_bottom">#2A000000</color> <color name="translucent_scrim_bottom_center">#0D000000</color>
对于尺寸,我使用了88dp的高度.
以上是大佬教程为你收集整理的android – CollapsingToolbarLayout:setShadowLayer全部内容,希望文章能够帮你解决android – CollapsingToolbarLayout:setShadowLayer所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。