NTabLayout is a simple tab bar custom view under android which has click-sliding and scaling up animation effect.

Overview

NTabLayout

Brief

NTabLayout is a simple tab bar custom view under android which has click-sliding and scaling up animation effect.

This tab bar's effect seems like Xue Qiu's tab bar, which can load tags on top of ViewPager and there's a click-sliding effect and scaling up animation.

Publish

International:

https://github.com/GinRyan/NTabLayout

China mainland:

https://gitee.com/kumakuri/NTabLayout

SnapShot

Usage

Add into project:

repositories {
    maven { url "https://jitpack.io" }
}

and add line:

implementation 'com.github.GinRyan:NTabLayout:0.3.4'

layout.xml

   <org.ginryan.github.slidingtab.NTabLayout
        android:id="@+id/tablayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:nTabUseAnimationFontScale="true">

        <org.ginryan.github.slidingtab.NTabView
            android:id="@+id/tabviewA"
            android:layout_width="90dp"
            android:layout_height="40dp"
            app:nTabTitleChecked="true"
            app:nTabTitleSize="26sp"
            app:nTabTitleText="Tab A" />
       ...
   </org.ginryan.github.slidingtab.NTabLayout>

NTabLayout have to include one or more NTabView to show tabs.

Attributes

CustomView attr name introduction
NTabLayout nTabUseAnimationFontScale Once this nTabUseAnimationFontScale attribute was set true, this will enable animation when switch tabs, or there will not be tween animation.
NTabView nTabTitleChecked Default check status. When set true, this tab will emphasize and scale up in default.
NTabView nTabTitleText Tab's text content.
NTabView nTabTitleSize Tab's text size .
NTabView nTabTitleColor Tab's text color.

Code

Class method introduction
NTabLayout setSelectedTab(int index) select tab.
NTabLayout addOnTabListener on tab select listener. When tab is selected by hand,it will call OnTabListener.onTabItemSelected(int itemIndex) to tell observer which tab is selected.

Usage:

setSelectedTab

NTabLayout tablayout = findViewById(...);
tablayout.setSelectedTab(0);

addOnTabListener

NTabLayout tablayout = findViewById(...);

tablayout.addOnTabListener(itemIndex -> {
    Log.d("Tab","Selected Tab: " + itemIndex);
});

Interact with ViewPager:

ViewPager viewPager = findViewById(...);
NTabLayout tablayout = findViewById(...);

viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
				//Causion!You can't not pull here.
            }

            @Override
            public void onPageSelected(int position) {
                tablayout.setSelectedTab(position);
            }

            @Override
            public void onPageScrollStateChanged(int state) {
            }
        });
tablayout.addOnTabListener(itemIndex -> {
            viewPager.setCurrentItem(itemIndex);
});

Third Party Library

Sources need no 3rd party dependencies.

But aapt need appcompat deps to build resources.

License

Copyright 2021 GinRyan, Kumakuri

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.
You might also like...
CustomNavigationDrawer - Custom Navigation Drawer with compose
CustomNavigationDrawer - Custom Navigation Drawer with compose

An easy sample to explore navigation component and navigation drawer from Jetpac

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.

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

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.

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

Navigation Drawer Bottom Navigation View
Navigation Drawer Bottom Navigation View

LIVE #019 - Toolbar, Navigation Drawer e BottomNavigationView com Navigation Com

Okuki is a simple, hierarchical navigation bus and back stack for Android, with optional Rx bindings, and Toothpick DI integration.

Okuki A simple, hierarchical navigation bus and back stack for Android, with optional Rx bindings, and Toothpick integration for automatic dependency-

A small and simple, yet fully fledged and customizable navigation library for Jetpack Compose
A small and simple, yet fully fledged and customizable navigation library for Jetpack Compose

A small and simple, yet fully fledged and customizable navigation library for Jetpack Compose

[ACTIVE] Simple Stack, a backstack library / navigation framework for simpler navigation and state management (for fragments, views, or whatevers).
[ACTIVE] Simple Stack, a backstack library / navigation framework for simpler navigation and state management (for fragments, views, or whatevers).

Simple Stack Why do I want this? To make navigation to another screen as simple as backstack.goTo(SomeScreen()), and going back as simple as backstack

Simple API implement DataBinding and ViewBinding.
Simple API implement DataBinding and ViewBinding.

Binding has been migrated to Maven Central because jCenter will be deprecated

The Words app is a simple dictionary app, with a list of letters, words for each letter, and the ability to look up definitions of each word in the browser.

Words App This folder contains the source code for the Words app codelab. Introduction Words app allows you to select a letter and use Intents to navi

Releases(0.3.4)
Owner
XellossRyan
人生苦短,放纵吧少年!
XellossRyan
Xdimen - Support multiple screen sizes easily by scaling your dimensions

Support multiple screen sizes easily by scaling your dimensions. How does Xdimen work? When you have a UI design with a specific dimension, and

Islam Khaled 38 Dec 8, 2022
Bottom-App-Bar-with-Bottom-Navigation-in-Jetpack-compose-Android - Bottom App Bar with Bottom Navigation in Jetpack compose

Bottom-App-Bar-with-Bottom-Navigation-in-Jetpack-compose-Android This is simple

Shruti Patel 1 Jul 11, 2022
🎉 [Android Library] A light-weight library to easily make beautiful Navigation Bar with ton of 🎨 customization option.

Bubble Navigation ?? A light-weight library to easily make beautiful Navigation Bars with a ton of ?? customization options. Demos FloatingTopBarActiv

Gaurav Kumar 1.7k Dec 31, 2022
An android navigation bar widget

Chip Navigation Bar A navigation bar widget inspired on Google Bottom Navigation mixed with Chips component. Usage <!-- bottom_menu.xml --> <menu xmln

Ismael Di Vita 743 Jan 1, 2023
React Native lets you customize the navigation bar for Android.

react-native-system-navigation-bar React Native lets you customize the navigation bar for Android. Hide Lean Back Immersive Sticky Immersive Low Profi

Kadir Aydınlı 120 Jan 3, 2023
BubbleTabBar is bottom navigation bar with customizable bubble like tabs

BubbleTabBar BubbleTabBar is bottom navigation bar with customizable bubble like tabs Usage <com.fxn.BubbleTabBar android:id="@+id/

Akshay sharma 576 Dec 30, 2022
A library that you can use for bottom navigation bar. Written with Jetpack Compose

FancyBottomNavigationBar A library that you can use for bottom navigation bar. W

Alperen Çevlik 3 Jul 27, 2022
NastiaGusev 2 Feb 11, 2022
Ahmad Shahwaiz 1 Jan 26, 2022
A simple Floating Action Button that shows an anchored Navigation View

Floating Navigation View A simple Floating Action Button that shows an anchored Navigation View and was inspired by Menu Material Fixed created by Tom

André Mion 1.3k Dec 29, 2022