CustomTabLayout - CustomTablayout works with viewpager2

Overview

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
You might also like...
lightweight and minimalist ORM for Java/Android. works with SQLite & MySQL. (not actively maintained)

Description ORMAN is an minimalistic and lightweight ORM framework for Java which can handle your common database usage without writing SQL and strugg

A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on Android 2.1+ (Eclair MR1 / level 7).

Android Switch Preference Backport A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on

Sample project created to show some of the best Android practices to work in the Android UI Layer. The UI layer of this project has been implemented using MVP or MVVM (without binding engine) to show how this patterns works. This project is used during the talk
lightweight and minimalist ORM for Java/Android. works with SQLite & MySQL. (not actively maintained)

Description ORMAN is an minimalistic and lightweight ORM framework for Java which can handle your common database usage without writing SQL and strugg

A backport of the Android 4.2 GlowPadView that works on the SDK on API levels 4+

GlowPadBackport A backport of the Android 4.2 GlowPadView that works on the SDK on API levels 4+. It is heavily based upon Google's own internal imple

A beautiful Android custom View that works similar to a range or seekbar. With animations.
A beautiful Android custom View that works similar to a range or seekbar. With animations.

ValueBar A beautiful Android custom View that works similar to a range or seekbar. Selection by gesture. With animations. Supporting API level 11+. De

RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works.
RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works.

RoboDemo RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works. A sample is available in the download area of

A simple and opinionated AES encrypt / decrypt Ruby gem that just works.

AESCrypt - Simple AES encryption / decryption for Ruby AESCrypt is a simple to use, opinionated AES encryption / decryption Ruby gem that just works.

Kodein-DB is a Kotlin/Multiplatform embedded NoSQL database that works on JVM, Android, Kotlin/Native and iOS.
Kodein-DB is a Kotlin/Multiplatform embedded NoSQL database that works on JVM, Android, Kotlin/Native and iOS.

Kodein-DB is a Kotlin/Multiplatform embedded NoSQL database that works on JVM, Android, Kotlin/Native and iOS. It is suited for client or mobile applications.

A 2020s compatible React Native keyboard avoiding view for Android and iOS that just works.

react-native-keyboard-shift Example Snack coming soon Until then: Clone this repo: git clone https://github.com/FullStackCraft/react-native-keyboard-s

File Picker for KMP project. Works for Android/JVM/Web.

KFilePicker File Picker for KMP project. Works for Android/JVM/Web. Setup Add Jitpack maven { url

Example Android library project that works with jitpack.io

android-example Example Android library project that works with jitpack.io. See this Tutorial on how to publish an Android Library with JitPack. For m

📲💬 react-native-fontext is a lightweight library to integrate fonts in your React Native application that works seamlessly in android and iOS devices.
📲💬 react-native-fontext is a lightweight library to integrate fonts in your React Native application that works seamlessly in android and iOS devices.

React Native Fontext react-native-fontext is a lightweight library to integrate fonts in your React Native application that works seamlessly in androi

Demo Spting REST Service on Kotlin. Works with PostgreSQL via Spring Data. Data initialization provided by liquibase

Spring Boot REST API with Kotlin Spring Boot REST API service. Spring Data with PostgreSQL. Data initialization with Liquibase. Swagger UI Reference D

Learn how to create a layout that works with all screen sizes of the device.

Learn how to create a layout that works with all screen sizes of the device.

Works Planning Application
Works Planning Application

Works Planning Application Clean Architecture MVVM Room database Binding Adapters Data Binding View Binding RecyclerView.Adapter DiffUtil LiveData Vie

DevTools for Android Chrome — works on any website, on any Chromium browser.
DevTools for Android Chrome — works on any website, on any Chromium browser.

DevTools for Android Chrome — works on any website, on any Chromium browser.

A rewrite of the popular project GitUp that works in Linux, Mac, and Windows.
A rewrite of the popular project GitUp that works in Linux, Mac, and Windows.

GitDown This is a rewrite from the ground up of the popular GitUp library available on Mac. It is built using Kotlin and Compose Desktop from Jetbrain

Android Ad Manager Works with Admob, Mopup, Facebook- Bidding and Audience Networks
Android Ad Manager Works with Admob, Mopup, Facebook- Bidding and Audience Networks

AndroidAdManager Works with Admob, Mopup, Facebook- Bidding and Audience Networks. Added ad types are NativeBanner, NativeAdvanced, Interstitial and B

Releases(1.0.1)
Owner
Ahmed
Android & Flutter Developer
Ahmed
Android Navigation Fragment Share Element Example: Use Share Element Transition with recyclerView Item and ViewPager2 Item.

Android-Navigation-Fragment-Share-Element-Example 说明 Android 使用Navigation导航切换Fragment中使用共享元素过渡动画的例子:将在listFragment的RecyclerView的Item共享元素过渡到pagerFragme

null 3 Sep 28, 2022
A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.

AnimatedBottomBar A customizable and easy to use bottom bar view with sleek animations. Examples Playground app Download the playground app from Googl

Joery 1.2k Dec 30, 2022
ViewPager2&TabLayout:拓展出一个选中放大效果

ViewPager2正式推出已经一年多了,虽然不如3那样新潮,但是也不如老前辈ViewPager那样有众多开源库拥簇,比如它的灵魂伴侣TabLayout明显后援不足,好在TabLayout自身够硬!

HBA 7 May 16, 2022
Android library for the adapter view (RecyclerView, ViewPager, ViewPager2)

Antonio Android library for the adapter view (RecyclerView, ViewPager, ViewPager2) Free from implementation of the adapter's boilerplate code ! Reuse

NAVER Z 106 Dec 23, 2022
A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.

A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.

Joery Droppers 1000 Dec 5, 2021
Android Navigation Fragment Share Element Example: Use Share Element Transition with recyclerView Item and ViewPager2 Item.

Android-Navigation-Fragment-Share-Element-Example 说明 Android 使用Navigation导航切换Fragment中使用共享元素过渡动画的例子:将在listFragment的RecyclerView的Item共享元素过渡到pagerFragme

null 3 Sep 28, 2022
Provides 9-patch based drop shadow for view elements. Works on API level 9 or later.

Material Shadow 9-Patch This library provides 9-patch based drop shadow for view elements. Works on API level 14 or later. Target platforms API level

Haruki Hasegawa 481 Dec 19, 2022
RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works.

RoboDemo RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works. A sample is available in the download area of

Stéphane Nicolas 220 Nov 25, 2022
Provides 9-patch based drop shadow for view elements. Works on API level 9 or later.

Material Shadow 9-Patch This library provides 9-patch based drop shadow for view elements. Works on API level 14 or later. Target platforms API level

Haruki Hasegawa 481 Dec 19, 2022