A Handy TabBar for Android
Java
Switch branches/tags
Nothing to show
Clone or download
81813780 Merge pull request #2 from bryant1410/master
Fix broken headings in Markdown files
Latest commit 50da5b6 Apr 17, 2017
Permalink
Failed to load latest commit information.
gradle/wrapper modify readme Feb 4, 2015
library version 1.0.4 Mar 4, 2015
sample version 1.0.4 Mar 4, 2015
.gitignore Initial commit Feb 2, 2015
README.md Fix broken Markdown headings Apr 16, 2017
build.gradle modify readme Feb 4, 2015
demo.gif replace demo.gif Feb 5, 2015
demo2.gif replace demo2.gif Feb 5, 2015
demo3.gif version 1.0.3 Feb 26, 2015
demo4.gif version 1.0.4 Mar 4, 2015
gradle.properties Initial commit Feb 2, 2015
gradlew Initial commit Feb 2, 2015
gradlew.bat Initial commit Feb 2, 2015
settings.gradle Initial commit Feb 2, 2015

README.md

HandyTabBar

Before that I have been using PagerSlidingTabStrip, it's really simple to use, But most of the time,I want to custom each tab or more things ,so I make this library with my thought, If you like, I hope you can give me more suggestion,Of course, I am very grateful to the PagerSlidingTabStrip author provided such a good code.

Demo

Usage

Step 1

Add dependencies in build.gradle.

	dependencies {
	   compile 'com.whl.handytabbar:library:1.0.4'
	}

Step 2

Add the HandyTabBar to your layout:

    <com.whl.handytabbar.HandyTabBar
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:id="@+id/tab_bar"
        android:background="@color/colorPrimary"
        />

In your java code with simple(Most of time I suggest you use customization,it's very flexible.):

    mTabBar= (HandyTabBar) findViewById(R.id.tab_bar);
    mTabBar.attachToViewPager(mViewPager);

Customization

When you use, I think you want more time to define your own, therefore, provided here

  • TabBarStyle(whole HandyTabBar style):
     TabBarStyle tabBarStyle=new TabBarStyle.Builder(this)
                      .setDrawIndicator(TabBarStyle.INDICATOR_LINE)
                      .setDrawLine(TabBarStyle.TOPLINE)
                      .setDrawDivider(drawDivider)
                      .setIndicatorHeight()
                      setDividerColor()
                      ...
                      .build();
      mTabBar.attachToViewPager(mViewPager,mTabBarStyle);
  • TabLayout(Single Tab should be like):

(your need to extend BaseTabLayout,like this SimpleTabLayout CustomTabLayout in sample project)

        mTabBar.attachToViewPager(mViewPager,customTabLayout);
  • Tips:

HandyTabBar don't provided about animation method(maybe later), but if you want to use animation, very simple, need only in onTabState () method to implements anything you want in the animation, I strongly recommend to use AndroidViewAnimations,just like this

    @Override
    public void onTabState(View v, boolean isSelected,int position) {
        ImageView imageView= (ImageView) v.findViewById(R.id.yourViewID);
        if (isSelected){
            YoYo.with(Techniques.Tada)
                .duration(700)
                .playOn(imageView);
        }else {
            ...
        }
    }

or look this CustomTabLayout;

Thanks

Contact me

I love open source project, if you have a better idea on this project or way, please let me know, thanks:)

Email

Weibo