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.

Tabindicator gradient drawable not working

See original GitHub issue

This is my code

activity.xml

<com.google.android.material.tabs.TabLayout android:layout_width=“match_parent” android:layout_height=“56dp” app:tabGravity=“center” app:tabIndicator=“@drawable/tabbar_indicator_gradient_blue” app:tabIndicatorFullWidth=“true” app:tabIndicatorHeight=“10dp” app:tabMode=“fixed” android:id=“@+id/tab”/>

tabbar_indicator_gradient_blue.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:endColor="#00b0eb" android:startColor="#0086b3"/> <corners android:topLeftRadius="3dp" android:topRightRadius="3dp"/> </shape>

TabIndicator is not showing up the gradient colour.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
dsn5ftcommented, Oct 23, 2020

@nucleons sorry I meant app:tabIndicatorColor="@null" or app:tabIndicatorColor="@empty" with using version 1.3.0-alpha03.

2reactions
nucleonscommented, Oct 23, 2020

@dsn5ft 1.3.0-alpha03 fixes the issue. Thanks for your support:)

Final code that is working

<com.google.android.material.tabs.TabLayout android:layout_width=“match_parent” android:layout_height=“56dp” app:tabIndicator=“@drawable/tabbar_indicator_gradient_blue” app:tabIndicatorHeight=“5dp” android:id=“@+id/tab” app:tabIndicatorColor=“@null”/>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom drawable as tabIndicator of com.google.android ...
I had the same issue when using a custom drawable. What fixed it for me was setting the tab indicator height. app:tabIndicatorHeight="2dp".
Read more >
TabLayout | Android Developers
Sets the tab indicator's color for the currently selected tab. ... will cause TabLayout to use the default, GradientDrawable line indicator.
Read more >
GradientDrawable in Android - GeeksforGeeks
A GradientDrawable is drawable with a color gradient that can be used for buttons, backgrounds, and so on. Let's begin with a simple...
Read more >
TabHostExtras | B4X Programming Forum
Set a GradientDrawable as the background on all TabIndicators in tabHost1 ... Color for selected and not selected tab state can be defined....
Read more >
Android TabLayout with Gradient Indicator | by Leonardo Vinsen
In the end, I came up with an idea to create a custom view with a gradient drawable and place it above the...
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