How to set support library snackbar text color to something other than android:textColor?

前端 未结 22 2354
温柔的废话
温柔的废话 2021-01-30 12:33

So I\'ve started using the new Snackbar in the Design Support Library, but I found that when you define \"android:textColor\" in your theme, it applies to the text color of the

22条回答
  •  后悔当初
    2021-01-30 12:53

    Alright so I fixed it by basically reorganizing the way I do text colors.

    In my light theme, I set android:textColorPrimary to the normal dark text I wanted, and I set android:textColor to white.

    I updated all of my text views and buttons to have android:textColor="?android:attr/textColorPrimary".

    So because snackbar draws from textColor, I just set all of my other text to textColorPrimary.

    EDIT JANUARY 2017: ----------------------------------------------------

    So as the comments say, and as stated in the edited original question above, you should probably not define android:textColor in your themes, as this changes the text color of every view inside the theme.

提交回复
热议问题