/tab-bar-view

Lightweight TabBarView for Android which is based just on View class

Primary LanguageKotlinApache License 2.0Apache-2.0

tab-bar-view

TabBarView is very lightweight lib for Android implemented in Kotlin and it's based just on View class.

#Add dependency Add it in your root build.gradle at the end of repositories:

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

Add the dependency:

dependencies {
    compile 'com.github.mklimek:tab-bar-view:$RELEASE_VERSION'
}

Check $RELEASE_VERSION here

#How to use it in Java? add it in onCreate():

TabBarView bottomView = (TabBarView) findViewById(R.id.bottomBar);

TabBarController.TabBuilder tabBuilder = TabBarController.TabBuilder.INSTANCE;
List<TabBarController.Tab> tabs = tabBuilder
        .addTab("Home", ContextCompat.getDrawable(this, R.mipmap.home), ContextCompat.getDrawable(this, R.drawable.gray), ContextCompat.getDrawable(this, R.drawable.orange))
        .addTab("Stats", ContextCompat.getDrawable(this, R.mipmap.stats), ContextCompat.getDrawable(this, R.drawable.gray), ContextCompat.getDrawable(this, R.drawable.orange))
        .addTab("Info", ContextCompat.getDrawable(this, R.mipmap.info), ContextCompat.getDrawable(this, R.drawable.gray), ContextCompat.getDrawable(this, R.drawable.orange))
        .build();

TabBarController controller = new TabBarController(this, tabs, bottomView);
controller.setListener(new TabBarListener() {
    @Override
    public void pageHasBeenChanged(int position) {
        //Change fragments here or... or something
    }
});
controller.setCurrentItem(0);

#How it can look like? How nice drawables do you have? :)