SlidingTab which can cross tab and word,and you can set a gradient color for the whole tab widget.
implementation 'com.vivian.widgets:slidingtab:1.0.4'
<com.vivian.slidingtab.SlidingTab
android:id="@+id/sliding_tab"
android:layout_width="match_parent"
android:layout_margin="10dp"
app:strokeWidth="2dp"
app:mainColor="#1A51AD"
app:mainColorRes="@color/colorAccent"
app:radius="100dp"
app:tabHeight="100dp"
app:textSize="16sp"
app:startColor="#a1aa0b"
app:endColor="#1F8F70"
android:layout_gravity="center"
android:layout_height="wrap_content"/>
app:strokeWidth="2dp" //set the width of outside roundrect
app:mainColor="#1A51AD" //set main color of the whole tab
app:mainColorRes="@color/colorAccent" //set main color resource.If both "mainColor" and "mainColorRes" are set,it will show as "mainColorRes“
app:radius="100dp" //set roundcorner radius size
app:tabHeight="100dp" //set the height of tab
app:textSize="16sp" //set textsize
app:startColor="#a1aa0b" //set start color of gradient part
app:endColor="#1F8F70" //set end color of gradient part
slidingTab.setTitles("Course", "Document");
or
slidingTab.setTitles(List<String> titles)
slidingTab.bindViewPager(viewPager);
slidingTab.setOnTabClickListener(new SlidingTab.OnTabClickListener() {
@Override
public void onTabClick(int position) {
viewPager.setCurrentItem(position);
}
});
Copyright 2019 Vivian
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.