Tabindicator gradient drawable not working
See original GitHub issueThis 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:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nucleons sorry I meant
app:tabIndicatorColor="@null"
orapp:tabIndicatorColor="@empty"
with using version1.3.0-alpha03
.@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”/>