Navigation tab strip with smooth interaction.

Overview

Devlight


NavigationTabStrip

Navigation tab strip with smooth interaction.

Android Arsenal       Android       Download       License       Codacy


Devlight

You can check the sample app here.

Warn

This library is not more supported. 
If you want to add new feature or fix a bug, grab source code and do it. 
If you think your fix or feature would be useful to other developers, 
I can add link of your repository to this README file. 
Thank you for using our libraries.

Download

You can download a .aar from GitHub's releases page.

Or use Gradle jCenter:

dependencies {
    repositories {
        mavenCentral()
        maven {
            url  'http://dl.bintray.com/gigamole/maven/'
        }
    }
    implementation 'com.github.devlight.navigationtabstrip:navigationtabstrip:+'
}

Or Gradle Maven Central:

compile 'com.github.devlight.navigationtabstrip:navigationtabstrip:1.0.4'

Or Maven:

<dependency>
    <groupId>com.github.devlight.navigationtabstrip</groupId>
    <artifactId>navigationtabstrip</artifactId>
    <version>1.0.4</version>
    <type>aar</type>
</dependency>

Android SDK Version

NavigationTabStrip requires a minimum SDK version of 11.

Sample

Parameters

For NTS you can set such parameters as:

  • color:
    allows you to set strip color.

  • size:
    allows you to set titles size. By default NTS use auto titles size.

  • weight:
    allows you to set weight(height) of strip.

  • factor:
    allows you to set strip resize factor.

  • titles:
    allows you to set NTS titles. This is your tabs.

  • type:
    allows you to set strip type - line or point.

  • gravity:
    allows you to set strip gravity - top or bottom.

  • view pager:
    allows you to connect NTS with ViewPager. If you want your can also set OnPageChangeListener.

  • typeface:
    allows you to set custom typeface to your titles.

  • corners radius:
    allows you to set corners radius of strip.

  • animation duration:
    allows you to set animation duration.

  • inactive color:
    allows you to set inactive titles color.

  • active color:
    allows you to set active title color.

  • tab strip listener:
    allows you to set listener which triggering on start or on end when you set tab index.

Tips

If your set ViewPager you can action down on active tab and do like drag.
NTS use only upper case titles.

Init

Check out in code init:

final NavigationTabStrip navigationTabStrip = (NavigationTabStrip) findViewById(R.id.nts);
navigationTabStrip.setTitles("Nav", "Tab", "Strip");
navigationTabStrip.setTabIndex(0, true);
navigationTabStrip.setTitleSize(15);
navigationTabStrip.setStripColor(Color.RED);
navigationTabStrip.setStripWeight(6);
navigationTabStrip.setStripFactor(2);
navigationTabStrip.setStripType(NavigationTabStrip.StripType.LINE);
navigationTabStrip.setStripGravity(NavigationTabStrip.StripGravity.BOTTOM);
navigationTabStrip.setTypeface("fonts/typeface.ttf");
navigationTabStrip.setCornersRadius(3);
navigationTabStrip.setAnimationDuration(300);
navigationTabStrip.setInactiveColor(Color.GRAY);
navigationTabStrip.setActiveColor(Color.WHITE);
navigationTabStrip.setOnPageChangeListener(...);
navigationTabStrip.setOnTabStripSelectedIndexListener(...);

Other methods check out in sample.

And XML init:

<com.gigamole.navigationtabstrip.NavigationTabStrip
    android:layout_width="match_parent"
    android:layout_height="50dp"
    app:nts_color="#000"
    app:nts_size="15sp"
    app:nts_weight="3dp"
    app:nts_factor="2.5"
    app:nts_titles="@array/titles"
    app:nts_type="point"
    app:nts_gravity="top"
    app:nts_typeface="fonts/typeface.otf"
    app:nts_corners_radius="1.5dp"
    app:nts_animation_duration="300"
    app:nts_active_color="#000"
    app:nts_inactive_color="#c4c4c4"/>

Getting Help

To report a specific problem or feature request, open a new issue on Github.

Xamarin

Thanks to Martijn van Dijk for developing Xamarin bindings library for NavigationTabStrip.
Plugin is available on Nuget.

Credits

Keren Rijensky Srikant Shetty Oleg Frolov

Author

Created by Basil Miller - @gigamole

Company

Facebook     Twitter     LinkedIn

Here you can see open source work developed by Devlight LLC.
This and another works is an exclusive property of Devlight LLC.

If you want to use this library in applications which will be available on Google Play, please report us about it or author of the library.

Whether you're searching for a new partner or trusted team for creating your new great product we are always ready to start work with you.

You can contact us via [email protected] or [email protected].
Thanks in advance.

Devlight LLC, 2016
devlight.io

Comments
  • How can i catch the changing tab?

    How can i catch the changing tab?

    Hi, i was looked the closed issues and saw Fragment implementing and i have a problem with this too. It's not clear to how to catch and how to change Fragments with your library. i have a 2 Fragments and i want to implement this with ViewPager but i can not. Please give an example for this. Thanks. By the way i 'm implementing your library with these codes:

    `

           mViewPager.setAdapter(new PagerAdapter() {
            @Override
            public int getCount() {
                return 2;
            }
    
            @Override
            public boolean isViewFromObject(final View view, final Object object) {
                return view.equals(object);
            }
    
            @Override
            public void destroyItem(final View container, final int position, final Object object) {
                ((ViewPager) container).removeView((View) object);
            }
    
            @Override
            public Object instantiateItem(final ViewGroup container, final int position) {
                final View view = new View(getBaseContext());
                container.addView(view);
                return view;
            }
        });
    
        mCenterNavigationTabStrip.setViewPager(mViewPager, 1);
    

    `

    help wanted 
    opened by canberkcakmak 6
  • Title new line

    Title new line

    Hi! Thanks for providing such a good library! I have a question: is there possibility to add new line to the TabTitle? I set text with "\n" but it drawing like single line. Thanks in advance!

    question 
    opened by oZBo 4
  • Asset not found:null Error

    Asset not found:null Error

    In my xml file it says Rendering problem Asset not found : null what should i do?

    during runtime it logcats this exception

    08-07 01:49:38.304 25153-25153/? W/System.err: java.lang.NullPointerException 08-07 01:49:38.304 25153-25153/? W/System.err: at android.graphics.FontFamily.nAddFontFromAsset(Native Method) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.graphics.FontFamily.addFontFromAsset(FontFamily.java:70) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.graphics.Typeface.createFromAsset(Typeface.java:185) 08-07 01:49:38.304 25153-25153/? W/System.err: at com.gigamole.navigationtabstrip.NavigationTabStrip.setTypeface(NavigationTabStrip.java:343) 08-07 01:49:38.304 25153-25153/? W/System.err: at com.gigamole.navigationtabstrip.NavigationTabStrip.(NavigationTabStrip.java:189) 08-07 01:49:38.304 25153-25153/? W/System.err: at com.gigamole.navigationtabstrip.NavigationTabStrip.(NavigationTabStrip.java:156) 08-07 01:49:38.304 25153-25153/? W/System.err: at java.lang.reflect.Constructor.newInstance(Native Method) 08-07 01:49:38.304 25153-25153/? W/System.err: at java.lang.reflect.Constructor.newInstance(Constructor.java:288) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.view.LayoutInflater.createView(LayoutInflater.java:611) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:747) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.view.LayoutInflater.rInflate(LayoutInflater.java:810) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.view.LayoutInflater.rInflate(LayoutInflater.java:813) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.view.LayoutInflater.rInflate(LayoutInflater.java:813) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.view.LayoutInflater.inflate(LayoutInflater.java:508) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.view.LayoutInflater.inflate(LayoutInflater.java:418) 08-07 01:49:38.304 25153-25153/? W/System.err: at com.geeky.adarsh.moviescollection.Fragments.MainFragment.onCreateView(MainFragment.java:72) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.support.v4.app.Fragment.performCreateView(Fragment.java:2074) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1286) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:758) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1671) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:619) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1239) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.app.Activity.performStart(Activity.java:6057) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2394) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.app.ActivityThread.access$800(ActivityThread.java:154) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.os.Looper.loop(Looper.java:135) 08-07 01:49:38.304 25153-25153/? W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5276) 08-07 01:49:38.304 25153-25153/? W/System.err: at java.lang.reflect.Method.invoke(Native Method) 08-07 01:49:38.304 25153-25153/? W/System.err: at java.lang.reflect.Method.invoke(Method.java:372) 08-07 01:49:38.304 25153-25153/? W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911) 08-07 01:49:38.304 25153-25153/? W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:706)

    bug help wanted 
    opened by Adarshjain 2
  • ClassNotFoundException on activity creation

    ClassNotFoundException on activity creation

    I imported the library by using Gralde Maven Central. I got no problem when I sync the projet and when I build the app but when I run it on my second activity (where the NavigationTabStrip is used) it crashes.

    Here is the stacktrace :

    06-23 21:38:27.792 29422-29422/com.linkpulsion.nethernalvibes E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                    Process: com.linkpulsion.nethernalvibes, PID: 29422
                                                                                    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.linkpulsion.nethernalvibes/com.linkpulsion.nethernalvibes.Player}: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class com.gigamole.library.NavigationTabStrip
                                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253)
                                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
                                                                                        at android.app.ActivityThread.access$1100(ActivityThread.java:221)
                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
                                                                                        at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                        at android.os.Looper.loop(Looper.java:158)
                                                                                        at android.app.ActivityThread.main(ActivityThread.java:7224)
                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
                                                                                     Caused by: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class com.gigamole.library.NavigationTabStrip
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
                                                                                        at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
                                                                                        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                                        at com.linkpulsion.nethernalvibes.Player.onCreate(Player.java:29)
                                                                                        at android.app.Activity.performCreate(Activity.java:6876)
                                                                                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
                                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
                                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                                                        at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                                                        at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                        at android.os.Looper.loop(Looper.java:158) 
                                                                                        at android.app.ActivityThread.main(ActivityThread.java:7224) 
                                                                                        at java.lang.reflect.Method.invoke(Native Method) 
                                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                                                     Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class com.gigamole.library.NavigationTabStrip
                                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
                                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
                                                                                        at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
                                                                                        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                                                        at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
                                                                                        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                                                        at com.linkpulsion.nethernalvibes.Player.onCreate(Player.java:29) 
                                                                                        at android.app.Activity.performCreate(Activity.java:6876) 
                                                                                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                                                        at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                                                        at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                        at android.os.Looper.loop(Looper.java:158) 
                                                                                        at android.app.ActivityThread.main(ActivityThread.java:7224) 
                                                                                        at java.lang.reflect.Method.invoke(Native Method) 
                                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                                                     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.gigamole.library.NavigationTabStrip" on path: DexPathList[[zip file "/data/app/com.linkpulsion.nethernalvibes-1/base.apk"],nativeLibraryDirectories=[/data/app/com.linkpulsion.nethernalvibes-1/lib/arm64, /vendor/lib64, /system/lib64]]
                                                                                        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                                        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                                        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                                        at android.view.LayoutInflater.createView(LayoutInflater.java:595)
                                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
                                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                                                        at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
                                                                                        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                                                        at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
                                                                                        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                                                        at com.linkpulsion.nethernalvibes.Player.onCreate(Player.java:29) 
                                                                                        at android.app.Activity.performCreate(Activity.java:6876) 
                                                                                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                                                        at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                                                        at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                        at android.os.Looper.loop(Looper.java:158) 
                                                                                        at android.app.ActivityThread.main(ActivityThread.java:7224) 
                                                                                        at java.lang.reflect.Method.invoke(Native Method) 
                                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                                                        Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.gigamole.library.NavigationTabStrip" on path: DexPathList[[dex file "/data/data/com.linkpulsion.nethernalvibes/files/instant-run/dex/slice-support-annotations-23.4.0_a6bb2a5bb9a40e4d6f6829e6518129a51f2ebb3b-classes.dex", dex file "/data/data/com.linkpulsion.nethernalvibes/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.linkpulsion.nethernalvibes/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.linkpulsion.nethernalvibes/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.linkpulsion.nethernalvibes/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.linkpulsion.nethernalvibes/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.linkpulsion.nethernalvibes/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.linkpulsion.nethernalvibes/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.linkpulsion.nethernalvibes
    06-23 21:38:27.792 29422-29422/com.linkpulsion.nethernalvibes D/Error: ERR: exClass=java.lang.ClassNotFoundException
    06-23 21:38:27.792 29422-29422/com.linkpulsion.nethernalvibes D/Error: ERR: exMsg=Didn't find class "com.gigamole.library.NavigationTabStrip" on path: DexPathList[[zip file "/data/app/com.linkpulsion.nethernalvibes-1/base.apk"],nativeLibraryDirectories=[/data/app/com.linkpulsion.nethernalvibes-1/lib/arm64, /vendor/lib64, /system/lib64]]
    06-23 21:38:27.792 29422-29422/com.linkpulsion.nethernalvibes D/Error: ERR: file=BaseDexClassLoader.java
    06-23 21:38:27.792 29422-29422/com.linkpulsion.nethernalvibes D/Error: ERR: class=dalvik.system.BaseDexClassLoader
    06-23 21:38:27.792 29422-29422/com.linkpulsion.nethernalvibes D/Error: ERR: method=findClass line=56
    
    bug wontfix 
    opened by Cypaubr 2
  • "Your both lib has same package name" error again!

    Hello GIGAMOLE,

    First of all, Great thank you for sharing this amazing widget 👍 I want to use NavigationTabStrip and NavigationTabBar in the same app. I wrote build.gradle like below:

    repositories {
        mavenCentral()
        maven {
            url  'http://dl.bintray.com/gigamole/maven/'
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:23.4.0'
    
        compile 'com.github.devlight.navigationtabbar:library:+'
        compile 'com.github.devlight.navigationtabstrip:library:+'
    }
    

    But it complains that

    Error:Execution failed for task ':app:processDebugResources'.
    > Error: more than one library with package name 'com.gigamole.library'
    

    So I changed build.gradle like below:

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:23.4.0'
    
        compile 'com.github.devlight.navigationtabstrip:library:1.0.1'
        compile 'com.github.devlight.navigationtabbar:library:1.2.0'
    }
    

    But It also complains again there is more than one library with package name 'com.gigamole.library'.

    Could you please fix this issue?

    Best Regards, Sungcheold Kim.

    bug duplicate 
    opened by skyfe79 2
  • Your both lib has same package name.

    Your both lib has same package name.

    i am already using your 'com.github.devlight.navigationtabbar:library:1.1.6' and today when i included your this library the below error pop out. Please do need full changes.

    Error:Execution failed for task ':app:processDebugResources'.

    Error: more than one library with package name 'com.gigamole.library'

    wontfix 
    opened by atulgoswami21 2
  • How to make same effect?

    How to make same effect?

    Здравствуйте! Спасибо вам за эту прекрасную библиотеку!:) Можете пожалуйста подсказать(желательно кодом) как сделать такой же эффект при листании?

    Hello! Thank you for this great library! :) Can you please suggest (preferably code) how to make the same effect when scrolling? 123

    help wanted 
    opened by shahbazly 1
  • Nested tabs doesn't load contents and freezes

    Nested tabs doesn't load contents and freezes

    The application contains 3 tabs - Home, About and FAQ. Within About tab, I've 2 more tabs namely - User details and Privacy Policy. Each of these will load a fragment into viewpager. Below is relevant code I am having now.

    HomeActivity.java

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        Intent intentData = getIntent();
        initUI();
    }
    
    private void initUI() {
        final ViewPager viewPager = (ViewPager) findViewById(R.id.vp_horizontal_ntb);
        ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
        adapter.addFrag(new HomeFragment(), "Home");
        adapter.addFrag(new AboutFragment(), "About");
        adapter.addFrag(new FAQFragment(), "FAQ");
        viewPager.setAdapter(adapter);
        final NavigationTabStrip navigationTabStrip = (NavigationTabStrip) findViewById(R.id.nts_bottom);
        navigationTabStrip.setViewPager(viewPager, 0);
    }
    

    AboutFragment.java

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        final View view=inflater.inflate(R.layout.fragment_about, container, false);
        new Thread(new Runnable() {
            @Override
            public void run() {
                initUI(view);
            }
        }).start();
    
        return view;
    }
    private void initUI(View view) {
        final ViewPager viewPager = (ViewPager) view.findViewById(R.id.about_horizontal_tab);
        ViewPagerAdapter adapter = new ViewPagerAdapter(getActivity().getSupportFragmentManager());
        adapter.addFrag(new UserDetailsFragment(), "User Details");
        adapter.addFrag(new PrivacyPolicyFragment(), "Privacy Policy");
        viewPager.setAdapter(adapter);
        final NavigationTabStrip navigationTabStrip = (NavigationTabStrip) view.findViewById(R.id.nts_top);
        navigationTabStrip.setViewPager(viewPager, 0);
    }
    

    ViewPagerAdapter.java

    public class ViewPagerAdapter extends FragmentPagerAdapter {
        private final List<Fragment> mFragmentList = new ArrayList<>();
        private final List<String> mFragmentTitleList = new ArrayList<>();
    
        public ViewPagerAdapter(FragmentManager manager) {
            super(manager);
        }
    
        @Override
        public Fragment getItem(int position) {
            return mFragmentList.get(position);
        }
    
        @Override
        public int getCount() {
            return mFragmentList.size();
        }
    
        public void addFrag(Fragment fragment, String title) {
            mFragmentList.add(fragment);
            mFragmentTitleList.add(title);
        }
    
        @Override
        public CharSequence getPageTitle(int position) {
            return mFragmentTitleList.get(position);
        }
    }
    

    But contents within About tab's, User Details and Privacy Policy never loads even though, when debugged, it hits the respective fragment's onCreateView method. Similarly, when I navigate to Privacy Policy tab it gets stuck there and doesn't navigate back to User Details tab on click.

    How could I possibly solve this issue? Is it supported to have nested tabs in android?

    opened by kshkrao3 0
  • Do a logic when tab is clicked (before switch to new tab)

    Do a logic when tab is clicked (before switch to new tab)

    I want to do a logic before changing tabs. In fact, when tab(1) is clicked, logic(1) will be performed. if logic(1) returns true, tab(2) will be opened, otherwise tab(1) will remain open.

    onPageSelected(position) method of setOnPageChangeListener interface returns new tab position, while I want to do my logic before starting to switch the tabs.

    how do I have to do that?

    opened by BigGitWorld 0
Releases(1.0.4)
Owner
Devlight
We deliver the right results in terms of efficiency, performance, interoperability, and user experience comprehensive technology.
Devlight
Navigation tab bar with colorful interactions.

NavigationTabBar Navigation tab bar with colorful interactions. You can check the sample app here. Warn This library is not more supported. If you wa

Devlight 4.9k Dec 31, 2022
Library for Sliding Tab With Color Icons!

Sliding Tab With Color Icons Sliding Tab With Color Icons! Kindly use the following links to use this library: In build.gradle (Project) allprojects {

Prabhakar Thota 35 Jan 22, 2022
Animated Tab Bar is an awesome navigation extension that you can use to add cool, animated and fully customizable tab navigation in your apps

Animated Tab Bar is an awesome navigation extension that you can use to add cool, animated and fully customizable tab navigation in your apps. The extension provides handy methods and properties to change the behaviour as well as the appearance of the navigation bar.

Zain Ul Hassan 4 Nov 30, 2022
A custom ViewPager title strip which gives continuous feedback to the user when scrolling

SmartTabLayout A custom ViewPager title strip which gives continuous feedback to the user when scrolling. This library has been added some features an

ogaclejapan 7k Jan 1, 2023
A custom ViewPager title strip which gives continuous feedback to the user when scrolling

SmartTabLayout A custom ViewPager title strip which gives continuous feedback to the user when scrolling. This library has been added some features an

ogaclejapan 7k Jan 7, 2023
Navigation tab bar with colorful interactions.

NavigationTabBar Navigation tab bar with colorful interactions. You can check the sample app here. Warn This library is not more supported. If you wa

Devlight 4.9k Dec 31, 2022
Extended Android Tab Layout with animated indicators that have continuous feedback.

Dachshund Tab Layout Introduction Boosted Android Tab Layout with custom animated indicators including "Dachshund" animation inspired by this. Sample

Andrii 859 Nov 10, 2022
Library for Sliding Tab With Color Icons!

Sliding Tab With Color Icons Sliding Tab With Color Icons! Kindly use the following links to use this library: In build.gradle (Project) allprojects {

Prabhakar Thota 35 Jan 22, 2022
NTabLayout is a simple tab bar custom view under android which has click-sliding and scaling up animation effect.

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 effe

XellossRyan 1 Oct 22, 2021
Will export all your words from LingQ to a tab-separated UTF-8 text file, Html, and Anki

LingQWordsExport Will export all your words from LingQ to a tab-separated UTF-8 text file, Html, and Anki. Here you can find a documentation page. Ins

Sergey Svistunov 2 Apr 21, 2022
Simple bottom navigation with side navigation drawer using Jetpack navigation UI made in Kotlin

BottomNavWithSideNavApp simple bottom navigation with side navigation drawer usi

Arvind Meshram 6 Oct 31, 2022
A little more fun for the pull-to-refresh interaction.

Pull-to-Refresh.Tours This project aims to provide a simple and customizable pull to refresh implementation. Check this [project on Behance] (https://

Yalantis 1.7k Dec 24, 2022
Floating hint from edit text - inspired by Matt D. Smith's design: http://dribbble.com/shots/1254439--GIF-Mobile-Form-Interaction?list=users

Float Labeled EditText Simple implementation of a Float Labeled EditText: An Android ViewGroup which uses a child EditText and puts the hint on top of

Wrapp Archive 1.1k Nov 14, 2022
android custom listview,with interaction pattern load more and pull to refresh to load data dinamically

The first thing that i have to say is render thanks to johannilsson because all the part of pull to refresh listview is based in the code of his repos

Fabian Leon 447 Nov 15, 2022
Android App for Classroom Interaction

即時課堂互動 Classroom Interaction App (畢業專題 2017) 指導教授: 趙一芬 組員: 許宸瑜, 謝子晏, 范植貿, 周易凱 Poster: png Report: word Slides: pdf 專題動機 : 往往電機系給人的印象是半導體、IC設計,而近年來,因為資

FanChiMao 1 Feb 13, 2022
Menyimpan source code tugas User Interaction and Control, mata kuliah Pemrograman Mobile Teori, semester lima tahun 2021.

android-uic About This Project Android-uic adalah sebuah aplikasi sederhana yang dibuat untuk menyelesaikan tugas dua mata kuliah pemrograman mobile.

Galang Aidil Akbar 1 Nov 8, 2021
Menyimpan source code tugas User Interaction and Control, mata kuliah Pemrograman Mobile Teori, semester lima tahun 2021.

android-uic About This Project Android-uic adalah sebuah aplikasi sederhana yang dibuat untuk menyelesaikan tugas dua mata kuliah pemrograman mobile.

Galang Aidil Akbar 1 Nov 8, 2021
Radio - a Minecraft Servers plugin for providing the best experience of interaction with broadcasting

Radio Radio is a Minecraft Servers plugin for providing the best experience of interaction with broadcasting. Installation Download required version f

Viktor 3 Dec 14, 2022