GithubHelp home page GithubHelp logo

spreadwind / gradienttabstrip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexmofer/tabstrip

0.0 1.0 0.0 124 KB

微信式渐变底部Tab效果,项目详细地址:

Home Page: https://github.com/AlexMofer/ProjectX/tree/master/gradienttabstrip

Java 100.00%

gradienttabstrip's Introduction

GradientTabStrip

ICON

项目详细地址:ProjectX(方便统一管理)

继承自BaseTabStrip,实现微信式渐变底部Tab效果,为ViewPager添加如PagerTitleStrip一样的Tab,但支持更多自定义功能,并支持为Tab增加标记点功能,并可以自定义标记点各自的位置及显示状态以及背景等。

预览

Screenshots

要求

  • minSdkVersion 14
  • 保持跟其他官方支持库版本一致(如:com.android.support:appcompat-v7)

引用

dependencies {
    ⋯
    compile 'am.widget:gradienttabstrip:26.0.1'
    ⋯
}

使用

  • 基本布局
<am.widget.gradienttabstrip.GradientTabStrip
    android:id="@+id/gts_gts_tabs"
    android:layout_width="match_parent"
    android:layout_height="64dp"
    android:textColor="@color/color_gradienttabstrip_tab"
    android:textSize="12sp"
    app:gtsBackground="@drawable/bg_common_press"/>
  • 基本代码
GradientTabStrip tabStrip = (GradientTabStrip) findViewById(id);
GradientTabStrip.GradientTabAdapter adapter = new GradientTabStrip.GradientTabAdapter () {
    @Override
    public Drawable getNormalDrawable(int position, Context context) {
        return null;
    }

    @Override
    public Drawable getSelectedDrawable(int position, Context context) {
        return null;
    }
  
    @Override
    public boolean isTagEnable(int position) {
        return false;
    }
  
    @Override
    public String getTag(int position) {
        return null;
    }
};
tabStrip.bindViewPager(viewPager);

注意

  • 不要使用ViewPage的setCurrentItem(int)方法,其不会通知到GradientTabStrip进行刷新,使用GradientTabStrip的performClick(int)方法
  • 布局时,android:textColor指定的颜色可以使用选择器,其中android:state_selected="true"状态下的颜色会与普通状态下的颜色进行渐变
  • GradientTabAdapter中进行了改变GradientTabAdapter,需要手动通知GradientTabStrip进行刷新
  • 不需要Tag小红点,可以使用SimpleGradientTabAdapter替代GradientTabAdapter
  • 保持跟其他官方支持库版本一致(如:com.android.support:appcompat-v7),否则可能出现错误

历史

gradienttabstrip's People

Contributors

alexmofer avatar

Watchers

James Cloos 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.