Giter Club home page Giter Club logo

tabview's Introduction

Android TabView

Download Platform License

Android首页底部常用tab切换控件

Features

  • TabViews in TabGroup only one can be checked

TabGroup 参考 RadioGroup api基本一致
TabView 参考 CompoundButton 实现 checkable

  • Support badge view for reminding

BadgeView is from https://github.com/liyanxi/BadgeView .All its attributes can also apply in the tabview.

  • Support water ripple effect when it's clicked

Water Ripple View is from https://github.com/isanwenyu/RippleEffect. TabView inherit from RippleView so all its attributes can also apply in the tabview.

  • Support chain API

Implement BadgeViewControl and RippleViewControl interface support chain API.

Quick Overview

image

Getting Started

  • Add the dependency to your build.gradle.
dependencies {
 	compile 'com.isanwenyu.tabview:tabview:1.2.5'
}
  • Maven:
<dependency>
  <groupId>com.isanwenyu.tabview</groupId>
  <artifactId>tabview</artifactId>g
  <version>1.2.5</version>
  <type>pom</type>
</dependency>

Usage

  • xml

    <com.isanwenyu.tabview.TabGroup
        android:id="@+id/tg_tab"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/white"
        android:elevation="10dp"
        app:checkedTab="@+id/tab_chat">
        
		......

        <com.isanwenyu.tabview.TabView
            android:id="@+id/tb_user"
            style="@style/TabView"
            app:badge_color="@android:color/holo_orange_dark"
            app:badge_count="888"
            app:badge_none_show="true"
            app:badge_padding_right="@dimen/tab_img_container_padding"
            app:badge_padding_top="@dimen/tab_img_container_padding"
            app:imgContainerPadding="@dimen/custom_img_container_padding"
            app:imgDrawable="@drawable/tab_user"
            app:imgMargin="@dimen/tab_img_margin"
            app:rv_centered="true"
            app:rv_color="@android:color/holo_orange_dark"
            app:rv_framerate="20"
            app:rv_rippleDuration="100"
            app:rv_zoom="true"
            app:rv_zoomDuration="200"
            app:rv_zoomScale="1.2"
            app:textColor="@color/tab_user_text_selector"
            app:textSize="@dimen/tab_view_text_size"
            app:textString="我" />
    </com.isanwenyu.tabview.TabGroup>
  • code

        //init tab badge view && ripple view,the others setted in activity_main.xml
        mChatTabView
                .setBadgeColor(getResources().getColor(android.R.color.holo_blue_dark))
                .setmDefaultTopPadding((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics()))
                .setBadgeShown(true)
                .setTabRippleCentered(false)
                .setTabRippleColor(android.R.color.holo_blue_dark)
                .setTabRippleDuration(100)
                //override setOnRippleCompleteListener method in rippleView
                .setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
            @Override
            public void onComplete(RippleView rippleView) {
                mChatTabView.setChecked(true);
            }
        });
        ((TabView) mTabGroup.getChildAt(1)).setBadgeCount(999)
                .setmDefaultTopPadding((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics()))
                .setBadgeShown(true)
                .setTabRippleEnable(false);

Todo

加入**仓库
添加红点标识
添加点击水波纹效果

Dependencies

License

Copyright 2016 [email protected]

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.

tabview's People

Contributors

isanwenyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.