question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[TabLayout] ripple is darker than set color

See original GitHub issue

Hi, all my ripples are of color ?attr/colorControlHighlight which I override to #11000000.

However if I override it on tabLayout via

<style name="DefaultTabLayout" parent="Widget.MaterialComponents.TabLayout">
    ...
    <item name="tabRippleColor">?attr/colorControlHighlight</item>
    ...
</style>

Its ripple is still way darker than some component next to it on which I manually set a ripple foreground selector

For completeness, here is the ripple selector I use on my other views

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="?attr/colorControlHighlight">

    <item android:id="@id/android:mask">
        <color android:color="@color/colorWhite" />
    </item>

</ripple>

First I thought It was a MDC thing, but then I also override rippleColor of a MaterialButton and that works fine.

Here is a screenshot

Screenshot_20200313-040540 (1)

You can see both the button and unselected tab pressed, and observe tab being way darker

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Janneman84commented, Aug 19, 2022

I’m experiencing the same thing in Android 13. It’s impossible to set app:tabRippleColor fully transparent…

What you can do for now is setting it to #0000, which is transparent white (instead of transparent black what android:color/transparent is.

Change white to whatever the background color is. Only problem this way is that it’s still broken in automatic dark mode in Android 13.

These are just workaround though, it’s something broken that hopefully gets fixed someday.

0reactions
ArcherEmiya05commented, Jul 16, 2022

Any update on this? We are not using Material 3 Theme and migrating to it requires a huge amount of time and effort. Now is not a right time for us to do it so we hope that there is an alternative way to fix this. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

TabLayout highlite and Ripple effect - android - Stack Overflow
1)Can i remove TabLayout highlight or change highlight color of tab layout? 2)Can i add ripple effect for tab. Each tab contain TextView...
Read more >
Tablayout Highlite And Ripple Effect - ADocLib
Sets the ripple color for this TabLayout.with GRAVITYCENTER while the tabs fit within the TabLayout's content width.xml.
Read more >
Tabs - Material Design
Tabs organize high level content in an app content, such as switching between views, data sets, or functional aspects of an app.
Read more >
Theming with AppCompat - Medium
As you might expect from the name, colorPrimaryDark is a darker variant of your primary color, which is used as the background color...
Read more >
TabHost - Android Developers
Whether or not the auto handwriting initiation is enabled in this View. ... android:outlineAmbientShadowColor, Sets the color of the ambient shadow that is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found