All Projects → stfalcon-studio → Bottomtablayout

stfalcon-studio / Bottomtablayout

Simple library for creating bottom tab layout. Made by Stfalcon

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Bottomtablayout

Tabby
Lightweight, accessible vanilla JS toggle tabs.
Stars: ✭ 449 (+855.32%)
Mutual labels:  tabs
Animatedtablayout
Yet another android tab layout
Stars: ✭ 572 (+1117.02%)
Mutual labels:  tabs
Jquery.tabslideout.js
jQuery plugin to create a side/top/bottom tab that slides out to show a feedback form, contact form, notepad etc.
Stars: ✭ 35 (-25.53%)
Mutual labels:  tabs
React Native Tab View
A cross-platform Tab View component for React Native
Stars: ✭ 4,742 (+9989.36%)
Mutual labels:  tabs
Responsive Tabs
Responsive Tabs is a jQuery plugin that provides responsive tab functionality. The tabs transform to an accordion when it reaches a CSS breakpoint. You can use this plugin as a solution for displaying tabs elegantly on desktop, tablet and mobile.
Stars: ✭ 529 (+1025.53%)
Mutual labels:  tabs
Labelsview
Android的标签列表控件。可以设置标签的选中效果。 可以设置标签的选中类型:不可选中、单选、限数量多选和不限数量多选等, 并支持设置必选项、单行显示、最大显示行数等功能。
Stars: ✭ 777 (+1553.19%)
Mutual labels:  tabs
Sysend.js
Send messages between open pages or tabs in same browser
Stars: ✭ 347 (+638.3%)
Mutual labels:  tabs
Ng Bootstrap
Angular powered Bootstrap
Stars: ✭ 7,872 (+16648.94%)
Mutual labels:  tabs
Ngx Ui
🚀 Style and Component Library for Angular
Stars: ✭ 534 (+1036.17%)
Mutual labels:  tabs
Tabulous
Filter, activate, select or close one or multiple tabs across windows --- all with your keyboard.
Stars: ✭ 10 (-78.72%)
Mutual labels:  tabs
Bootstrap Vertical Tabs
Missing vertical tabs component for bootstrap.
Stars: ✭ 489 (+940.43%)
Mutual labels:  tabs
Simple Tab Groups
Create, modify and quick change tab groups. Inspired by the Tab Groups app :)
Stars: ✭ 500 (+963.83%)
Mutual labels:  tabs
React Native Scrollable Tab View
Tabbed navigation that you can swipe between, each tab can have its own ScrollView and maintain its own scroll position between swipes. Pleasantly animated. Customizable tab bar
Stars: ✭ 6,784 (+14334.04%)
Mutual labels:  tabs
Fancy bottom navigation
Flutter plugin - FancyBottomNavigation
Stars: ✭ 450 (+857.45%)
Mutual labels:  tabs
Unload Tabs
WebExtension that unloads tabs and prevents tabs from loading
Stars: ✭ 38 (-19.15%)
Mutual labels:  tabs
Electron Tabs
Simple tabs for Electron applications
Stars: ✭ 350 (+644.68%)
Mutual labels:  tabs
Vue Tabs Component
An easy way to display tabs with Vue
Stars: ✭ 616 (+1210.64%)
Mutual labels:  tabs
Tabsorter2
Google Chrome Tab Management Extension - Merge, Sort, split and more :)
Stars: ✭ 44 (-6.38%)
Mutual labels:  tabs
Wheels
笨办法造轮子
Stars: ✭ 1,007 (+2042.55%)
Mutual labels:  tabs
Stabs
tabs in vanilla JS
Stars: ✭ 9 (-80.85%)
Mutual labels:  tabs

BottomTabLayout

alt tag

Simple library for bottom tab layout

Download

Download via Gradle:

compile 'com.github.stfalcon:bottomtablayout:0.3'

or Maven:

<dependency>
  <groupId>com.github.stfalcon</groupId>
  <artifactId>bottomtablayout</artifactId>
  <version>0.3</version>
  <type>pom</type>
</dependency>

Usage

Create text selector:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="@color/black" android:state_pressed="true" /> <!-- pressed -->
    <item android:color="@color/black" android:state_selected="true" /> <!-- selected -->
    <item android:color="@color/white" /> <!-- default -->
</selector>

Create drawable selector for each button icon:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/ic_button1_dark" android:state_pressed="true" /> <!-- pressed -->
    <item android:drawable="@drawable/ic_button1_dark" android:state_selected="true" /> <!-- selected -->
    <item android:drawable="@drawable/ic_button1" /> <!-- default -->
</selector>

Create menu resource file with items. Where title is title of button and icon is button drawable.

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/menu_button1"
        android:icon="@drawable/tab_button1_selector"
        android:title="Button1" />

    <item
        android:id="@+id/menu_button2"
        android:icon="@drawable/tab_button1_selector"
        android:title="Button2" />

    <item
        android:id="@+id/menu_button3"
        android:icon="@drawable/tab_button1_selector"
        android:title="Button3" />

    <item
        android:id="@+id/menu_button4"
        android:icon="@drawable/tab_button1_selector"
        android:title="Button4" />

    <item
        android:id="@+id/menu_button5"
        android:icon="@drawable/tab_button1_selector"
        android:title="Button5" />
</menu>

Create style for button

<style name="TabButtonTextStyle" parent="android:Widget.Button">
        <item name="android:textSize">12sp</item>
        <item name="android:textColor">@drawable/tab_button_text_selector</item>
</style>

Add bottomtablayout view to activity layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.stfalcon.bottomtablayout_sample.MainActivity">

    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/bottomTabLayout" />

    <com.stfalcon.bottomtablayout.BottomTabLayout
        android:id="@+id/bottomTabLayout"
        android:layout_width="match_parent"
        android:layout_height="58dp"
        android:layout_alignParentBottom="true"
        android:background="@color/dark" />

</RelativeLayout>

In activity class:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        container = R.id.container; //Container for fragments

        //Setup button tab layout
        bottomTabLayout = (BottomTabLayout) findViewById(R.id.bottomTabLayout);
        //set button text style
        bottomTabLayout.setButtonTextStyle(R.style.TextGray16);
        // set buttons from menu resource
        bottomTabLayout.setItems(R.menu.menu_bottom_layout);
        //set on selected tab listener.
        bottomTabLayout.setListener(new BottomTabLayout.OnItemSelectedListener() {
            @Override
            public void onItemSelected(int id) {
                switchFragment(id);
            }
        });
        //set button that will be select on start activity
        bottomTabLayout.setSelectedTab(R.id.menu_button1);
        //enable indicator
        bottomTabLayout.setIndicatorVisible(true);
        //indicator height
        bottomTabLayout.setIndicatorHeight(getResources().getDimension(R.dimen.indicator_height));
        //indicator color
        bottomTabLayout.setIndicatorColor(R.color.green);
        //indicator line color
        bottomTabLayout.setIndicatorLineColor(R.color.dark);
    }

For example we can switch fragments in container:

/**
     * Show fragment in container
     * @param id Menu item res id
     */
    public void switchFragment(int id) {
        Fragment fragment = null;
        switch (id) {
            case R.id.menu_button1:
                fragment = ColoredFragment.newInstance(R.color.blue, "Fragment 1");
                break;
            case R.id.menu_button2:
                fragment = ColoredFragment.newInstance(R.color.green, "Fragment 2");
                break;
            case R.id.menu_button3:
                fragment = ColoredFragment.newInstance(R.color.pink, "Fragment 3");
                break;
            case R.id.menu_button4:
                fragment = ColoredFragment.newInstance(R.color.blueDark, "Fragment 4");
                break;
            case R.id.menu_button5:
                fragment = ColoredFragment.newInstance(R.color.white, "Fragment 5");
                break;
        }
        if (fragment != null) {
            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            transaction.replace(container, fragment);
            transaction.commit();
        }
    }

For showing bubble count on tab.

bottomTabLayout.showTabBubbleCount(R.id.menu_button1, 3);

You can style bubble with methods:

bottomTabLayout.setTabBubbleColor(ContextCompat.getColor(this, R.color.blue));
bottomTabLayout.setTabBubblePadding(0, 0, 0, 0);
bottomTabLayout.setTabBubbleTextStyle(R.style.TextWhite12);

Take a look at the sample project for more information.

License

Copyright 2017 stfalcon.com

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].