Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

PagerSlidingTabStrip

> 编程语言
Open source

Android-导航栏特效,新闻类APP(仿iOS 版的网易,今日头条效果),主要是导航栏字体大小和颜色的渐变特效

370 stars0 likes1 views
WebsiteGitHub

About

Android-导航栏特效,新闻类APP(仿iOS 版的网易,今日头条效果),主要是导航栏字体大小和颜色的渐变特效

PagerSlidingTabStrip

Android-导航栏特效,主要是导航栏字体大小和颜色的渐变特效 可以是固定的几个,可也可以是水平滚动 #原理分析与实现

效果图

属性

java
app:pstsIndicatorColor  指示器的颜色
app:pstsIndicatorHeight 指示器的高度
app:pstsUnderlineColor 底部线的颜色
app:pstsUnderlineHeight 底部线的高度
app:pstsDividerColor 分割线的颜色
app:pstsDividerPaddingTopBottom 分割线的上下间距
app:pstsTabPaddingLeftRight 文本的左右间距
app:pstsTextSelectedColor TAB选中的颜色
app:pstsScrollOffset
app:pstsTabBackground 每一个TAB的背景

app:pstsShouldExpand
app:pstsTextAllCaps 所有的小写英文文本自动大写 ,默认是true,默认大写

app:pstsScaleZoomMax
android:textColor="@color/color_45c01a" 正常状态的文字颜色
android:textSize="16sp" 正常状态的文字的大小
app:pstsSmoothScrollWhenClickTab="false" 当点击tab时内容区域Viewpager是否是左右滑动,默认是true

声明-布局中

java

Java 代码

java
private PagerSlidingTabStrip tabs;
tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
ArrayList list=new ArrayList<>();
    for (int i=0;i
        com.gxz.pagerslidingtabstrip
        library
        1.3.1
        jar
        sources

Gradle

java
dependencies {
        compile 'com.gxz.pagerslidingtabstrip:library:1.3.1'
}

注意

因项目中的library中依赖了两个库

java
dependencies {
  compile 'com.android.support:appcompat-v7:23.1.1'
  compile 'com.nineoldandroids:library:2.4.0'
}
使用时有可能这两个依赖有新版本了 你可以这样将library中两个依赖库导出,用法如下,再依赖你自己的最新的库
dependencies {
compile('com.gxz.pagerslidingtabstrip:library:1.3') {
        // exclusion for update the android support jar
        // for example, you can use the appcompat-v7 in your project
        exclude group: 'com.android.support', module: 'appcompat-v7'
        exclude group: 'com.nineoldandroids', module: 'library'
    }
}

#V-1.2 FIX-BUG 1.修改点击TAB颜色渐变不全的问题

2.增加:当点击tab时内容区域Viewpager是否是左右滑动,默认是true

java
app:pstsSmoothScrollWhenClickTab="false"  属性
tabs.setSmoothScrollWhenClickTab(true);   JAVA方法

#V-1.3 FIX-BUG 1.setTabPaddingLeftRight(int padding) 设置不起作用的问题

#V-1.3.1 加入对title单击和双击的处理监听即OnPagerTitleItemClickListener

java
  mPagerSlidingTabStrip.setOnPagerTitleItemClickListener(new PagerSlidingTabStrip.OnPagerTitleItemClickListener() {
            @Override
            public void onSingleClickItem(int position) {
                Toast.makeText(LayoutActivity.this, "单击", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onDoubleClickItem(int position) {
                Toast.makeText(LayoutActivity.this, "双击", Toast.LENGTH_SHORT).show();
            }
        });

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言