An Android Library to help you create actionbar tabs like "Capitaine train" app by Cyril Mottier

Related tags

ActionBar TabBarView
Overview

TabBarView


An Android Library to help you create actionbar tabs like "Capitaine train" app by Cyril Mottier

alt tag


Implementation:

Declare TabBarView and set a ViewPager

		LayoutInflater inflator =
				(LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		View v = inflator.inflate(R.layout.custom_ab, null);
		tabBarView = (TabBarView) v.findViewById(R.id.tab_bar);

		getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
		getActionBar().setCustomView(v);
		// Create the adapter that will return a fragment for each of the three
		// primary sections of the activity.
		mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

		// Set up the ViewPager with the sections adapter.
		mViewPager = (ViewPager) findViewById(R.id.pager);
		mViewPager.setAdapter(mSectionsPagerAdapter);

		tabBarView.setViewPager(mViewPager);

Example using a simple pager adapter

	public class SectionsPagerAdapter extends FragmentPagerAdapter implements IconTabProvider{

		private int[] tab_icons={R.drawable.ic_tab1,
				R.drawable.ic_tab2,
				R.drawable.ic_tab3,
		};


		public SectionsPagerAdapter(FragmentManager fm) {
			super(fm);
		}

		@Override
		public Fragment getItem(int position) {
			// getItem is called to instantiate the fragment for the given page.
			// Return a PlaceholderFragment (defined as a static inner class
			// below).
			return PlaceholderFragment.newInstance(position + 1);
		}

		@Override
		public int getCount() {
			// Show 3 total pages.
			return tab_icons.length;
		}

		@Override
		public int getPageIconResId(int position) {
			return tab_icons[position];
		}

		@Override
		public CharSequence getPageTitle(int position) {
			Locale l = Locale.getDefault();
			switch (position) {
			case 0:
				return getString(R.string.title_section1).toUpperCase(l);
			case 1:
				return getString(R.string.title_section2).toUpperCase(l);
			case 2:
				return getString(R.string.title_section3).toUpperCase(l);
			}
			return null;
		}
	}

##Some ScreenShot

alt tag alt tag alt tag

####License

 Copyright 2014 Mirko Dimartino

 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.

####Developed by

Mirko Dimartino

You might also like...
News Stand app makes the ActionBar not boring!
News Stand app makes the ActionBar not boring!

No boring ActionBar http://flavienlaurent.com/blog/2013/11/20/making-your-action-bar-not-boring/ An explaination on how to implement the edition scree

BubbleTabBar is bottom navigation bar with customizable bubble like tabs
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/

BubbleTabBar is bottom navigation bar with customizable bubble like tabs
BubbleTabBar is bottom navigation bar with customizable bubble like tabs

BubbleTabBar BubbleTabBar is bottom navigation bar with customizable bubble like tabs Download AIX : Download Aix License Licensed under the Apache Li

An example of how to extend the ActionBar under the status bar from the theme
An example of how to extend the ActionBar under the status bar from the theme

Extended ActionBar The problem: Android 4.4 Kitkat introduced a wonderful new opportunity: translucent bars. It's as simple as adding the following to

A TimelineView that will help you create event timelines in apps just like the Google Calendar DayView
A TimelineView that will help you create event timelines in apps just like the Google Calendar DayView

TimelineView A TimelineView that will help you create event timelines in apps just like the Google Calendar DayView A library that allows you to creat

Show worldwide headline. API/Glide library/recycler view/volley library/kotlin/xml/ chrome custom tabs
Show worldwide headline. API/Glide library/recycler view/volley library/kotlin/xml/ chrome custom tabs

Show worldwide headline. API/Glide library/recycler view/volley library/kotlin/xml/ chrome custom tabs. - you can click on headline and it will open an article of that news in the app(no need to go to chrome or any browser)

A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.

Swipecards Travis master: A Tinder-like cards effect as of August 2014. You can swipe left or right to like or dislike the content. The library create

Android scrollable tabs
Android scrollable tabs

Scrollable is a library for an Android application to implement various scrolling technicks. It's all started with scrolling tabs, but now much more c

Custom Tabs with Material Design effects
Custom Tabs with Material Design effects

MaterialTabs Custom Tabs with Material Design animations for pre-Lollipop devices       Download example apk It requires 14+ API and android support v

Custom Tabs with Material Design effects
Custom Tabs with Material Design effects

MaterialTabs Custom Tabs with Material Design animations for pre-Lollipop devices       Download example apk It requires 14+ API and android support v

An instance-state saving fragment switcher, intended for use with navigation drawers or tabs.

FragmentSwitcher FragmentSwitcher is an adapter-based, state-saving fragment container similar to a ViewPager. It was designed with the NavigationDraw

Put some bubble in your tabs and give your apps a supa fresh style !
Put some bubble in your tabs and give your apps a supa fresh style !

BubbleTab Put some bubble in your tabs and give your apps a supa fresh style ! Usage Add a BubbleTab with your icons on the layout.xml Customisable pa

An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!

SlidingMenu (Play Store Demo) SlidingMenu is an Open Source Android library that allows developers to easily create applications with sliding menus li

An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!

SlidingMenu (Play Store Demo) SlidingMenu is an Open Source Android library that allows developers to easily create applications with sliding menus li

BindsAdapter is an Android library to help you create and maintain Adapter class easier via ksp( Kotlin Symbol Processing).

BindsAdapter BindsAdapter is an Android library to help you create and maintain Adapter class easier via ksp( Kotlin Symbol Processing). Installation

👋 A common toolkit (utils) ⚒️ built to help you further reduce Kotlin boilerplate code and improve development efficiency. Do you think 'kotlin-stdlib' or 'android-ktx' is not sweet enough? You need this! 🍭

Toolkit [ 🚧 Work in progress ⛏ 👷 🔧️ 🚧 ] Snapshot version: repositories { maven("https://s01.oss.sonatype.org/content/repositories/snapshots") }

AnimApp is an app that recommends you random anime and you can add it to your favourite if you like it.
AnimApp is an app that recommends you random anime and you can add it to your favourite if you like it.

papb-team6 AnimApp is an app that recommends you animes and you can add it to your favourite if you like it. Team members: Firdaus Bisma Suryakusuma (

A simple library that can help you detect if you app is modded or tampered with
A simple library that can help you detect if you app is modded or tampered with

Android Tamper Detector A simple library that can help you detect if you app is modded or tampered with. This adds a security level that makes it diff

A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix.
A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix.

SuperForwardView About A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix. GIF Design Credi

Comments
  • Fix not use addOnGlobalLayoutListener to get mSelectedTab

    Fix not use addOnGlobalLayoutListener to get mSelectedTab

    In some devices, mSelectedTab from PageListener onPageScrolled is not always equals pager.getCurrentItem()

    afater debug OnPageChangeListener onPageScrolled event. i get mSelectedTab values is only 0, 0 , 1 when I scroll the three Tab in one samsung device but after I call notifyDataSetChanged() I get mSelectedTab = mViewPager.getCurrentItem() is 1 when the tab selected in the second Tab , is't not equals 0

    and not need use addOnGlobalLayoutListener to get mSelectedTab values

    mSelectedTab always record afater onPageScrolled called

    opened by xingstarx 0
  • How to add notification icon in second viewpager header android

    How to add notification icon in second viewpager header android

    Hi, can you please tell me how to add relative layout[or textview with background to show count in second viewpager header] instead of adding only icon to the tab header (this is not an issue just question to know how to do it)

    opened by veerastha 0
  • Set LayoutParams for Android 5.0 Toolbar

    Set LayoutParams for Android 5.0 Toolbar

    The Android 5.0 Toolbar adds extra padding, causing TabBarView to not match parent.

    lollipop-tbv

    Adding the following after calling super(context, attrs, defStyle); in TabBarView fixes the issue:

    setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                    LinearLayout.LayoutParams.MATCH_PARENT));
    

    The material design guidelines show that no dividers should be used in tabs. I suggest you remove the dividers to match the new guidelines.

    opened by jaredrummler 3
  • FragmentPagerAdapter subclass must implement getPageTitle

    FragmentPagerAdapter subclass must implement getPageTitle

    In TabBarView you are calling pager.getAdapter().getPageTitle(i).toString() which will throw an NPE if it is unimplemented. Since getPageTitle is not abstract, the CharSequence returned should be checked.

    https://github.com/Mirkoddd/TabBarView/blob/master/TabBarViewLibrary/src/com/mirko/tbv/TabBarView.java#L174

    opened by alunsford3 0
Owner
Mirko Dimartino
Mirko Dimartino
An example of how to extend the ActionBar under the status bar from the theme

Extended ActionBar The problem: Android 4.4 Kitkat introduced a wonderful new opportunity: translucent bars. It's as simple as adding the following to

Eugenio Marletti 160 Nov 11, 2022
Android - a library that adds a glass-like effect to the action bar.

GlassActionBar GlassActionBar is an Android library which implements a glass-like effect for the action bar. The three most commonly used action bar i

Manuel Peinado Gallego 1.2k Nov 20, 2022
Socially is a textView which is able to create separate clickable views according to your requirements.

Socially is a textView which is able to create separate clickable views according to your requirements.

Enes Zor 30 Oct 25, 2022
🛒 Add a cart icon with item counter to the Toolbar. You can increment the counter based on the number of unique items the user has in the shopping cart.

Status CartCounter Add a cart icon with item counter to the Toolbar. You can increment the counter based on the number of unique items the user has in

Rowland Oti 30 Sep 23, 2021
Android library implementing a fading effect for the action bar, similar to the one found in the Play Music app

FadingActionBar FadingActionBar is a library which implements the cool fading action bar effect that can be seen in the new Play Music app. This libra

Manuel Peinado Gallego 2.9k Nov 21, 2022
PasswordStrengthView - an android library to represent password strength.

PasswordStrengthView - an android library to represent password strength.

null 33 Jan 3, 2022
[] Action bar implementation which uses the native action bar on Android 4.0+ and a custom implementation on pre-4.0 through a single API and theme.

DEPRECATED ActionBarSherlock is deprecated. No more development will be taking place. For an up-to-date action bar backport use AppCompat. Thanks for

Jake Wharton 7.1k Dec 24, 2022
Android Application with Kotlin to easily see who's present and absent

Android Application with Kotlin to easily see who's present and absent The appli

Lucas Aries 1 Jan 3, 2022
In-layout notifications. Based on Toast notifications and article by Cyril Mottier (http://android.cyrilmottier.com/?p=773).

Android AppMsg (Crouton) Library Implementation of in-layout notifications. Based on Toast notifications and article The making of Prixing #4: in-layo

Evgeny Shishkin 1.4k Nov 25, 2022
This library offers a simple method to add a small badge icon to your ActionBar-MenuItem

Android-ActionItemBadge ActionItemBadge is a library which offers a simple and easy to use method to add a badge to your action item! Screenshots Incl

Mike Penz 1.3k Jan 1, 2023