Android CollapsingToolbarLayout Title background

前端 未结 4 1311
無奈伤痛
無奈伤痛 2020-12-12 17:31

I\'m working with the CollapsingToolbarLayout from the new Android Design Support Library.

I have set its title and it is working fine, the only problem I still have

4条回答
  •  离开以前
    2020-12-12 17:49

    Use a text protection scrim(scroll down a bit). My example assumes the title text is white, so some tweaks may be necessary to optimize for your case.

    Inside your CollapsingToolbarLayout, add the following after ivBigImage:

    
    
    
    

    In your Drawable folder, add:

    scrim_top.xml

    
    
    
    

    and scrim_bottom.xml

    
    
    
    

    For colors, you should make these darker in initial testing so it's more obvious you have it working, but for production I used:

    #26000000
    #0C000000
    #2A000000
    #0D000000
    

    And for dimensions, I used a height of 88dp.

提交回复
热议问题