Giter Club home page Giter Club logo

tablayout_slidercustom_icons_viewpager's Introduction

SliderTabLayout with Icons.

Hello, I have focused on the implementation of Sliding TabLayout with Icons attahed to it, in which you will also get to know how ViewPager & FragmentPagerAdapter plays an important role to provide more functionality to the TabLayouts.

What you will learn.

  • Extend FragmentPagerAdapter.

  • Implementation of design support library in build.gradle(Module:app).

  • Remove ActionBar, check res->values->styles.xml.

  • Proper use of text in strings.xml file in a project, check res->values.

Note to Novice

In MainActivity onCreate method:

Remember to use setupViewPager() before setupTabIcons() otherwise you will get a null pointer exception on runtime.

  • setupViewPager();
{
        ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
        viewPagerAdapter.addFragment(new One(),"Frag One");
        viewPagerAdapter.addFragment(new Two(),"Frag Two");
        viewPagerAdapter.addFragment(new Three(),"Frag Three");
        viewPagerAdapter.addFragment(new Four(),"Frag Four");
        viewPagerAdapter.addFragment(new Five(),"Frag Five");
        viewPagerAdapter.addFragment(new Six(),"Frag Six");

        viewPager.setAdapter(viewPagerAdapter);
        }
  • setupTabIcons();
{
        tabLayout.getTabAt(0).setIcon(tabIcons[0]);
        tabLayout.getTabAt(1).setIcon(tabIcons[1]);
        tabLayout.getTabAt(2).setIcon(tabIcons[2]);
        tabLayout.getTabAt(3).setIcon(tabIcons[3]);
        tabLayout.getTabAt(4).setIcon(tabIcons[4]);
        tabLayout.getTabAt(5).setIcon(tabIcons[5]);
        }

Support ๐Ÿ‘

Instagram

Thank You!

tablayout_slidercustom_icons_viewpager's People

Contributors

amansharma-dev avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.