Popularity
0.3
Declining
Activity
0.0
Stable
0
1
1

Description

Simple libaray helps you to set your tablayout to work with viewpager2.

Programming language: Java
Tags: Kotlin     UI     Android     Java     Custom View     Android-library     TabLayout     Viewpager2    
Latest version: v1.0.1

CustomTabLayout alternatives and similar packages

Based on the "Kotlin" category.
Alternatively, view CustomTabLayout alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of CustomTabLayout or a related project?

Add another 'Kotlin' Package

README

CustomTabLayout supports ViewPager2

This project hepls you to set your tablayout to work with viewpager2.

eng arabic

Gradle

Step 1. Add the JitPack repository to your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
      maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the library dependency to your project build.gradle:

dependencies {
  implementation 'com.google.android.material:material:(lastest release version)'
  implementation 'com.github.AhmedAbdEllatiif:Customtablayout:(lastest release version)'
}

Usage

In your XML file add this:

<com.ahmed.library.CustomTabLayout
        android:id="@+id/tabLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:tabGravity="fill"
        app:tabMode="fixed"
        app:tabTextColor="@color/colorPrimaryDark"
        app:tabSelectedTextColor="@color/colorAccent"
        app:tabIndicatorColor="@color/colorAccent"
        app:selectedIconColor="@color/colorAccent"
        app:unSelectedIconColor="@color/colorPrimaryDark"
        app:smoothScroll="true"
        />

Attributes

Attribute Description
app:selectedIconColor="" To change icon color when the icon is selected (default=Color.DKGRAY)
app:unSelectedIconColor="" To change icon color when the icon is unSelected (default=Color.GRAY)
app:smoothScroll="boolean" To make the viewPager scroll smooth or not when tabs clicked (default = true)
app:showIndicator="boolean" To show or hide tab indicator (default = true)

In your Java class:

CustomTabLayout tabLayout = findViewById(R.id.tabLayout);
tabLayout.titles(getTitlesList());
tabLayout.iconsResources(getIcons());
tabLayout.setupWithViewPager(viewPager);

Or your Koltin class:

val customTabLayout : CustomTabLayout = findViewById(R.id.tabLayout)
customTabLayout.iconsResources(getIcons())
customTabLayout.titles(getTitlesList())
customTabLayout.setupWithViewPager(viewPager)

Methods

Method Description
customTabLayout.iconsResources() To insert icons of tabs
customTabLayout.titles() To insert titles of tabs
customTabLayout.tabsCount() To set the tabs count requeried when there are no titles or icons (default = 0)
customTabLayout.setupWithViewPager() To build the tablayout with your viewpager