All Projects → q805699513 → Pagerslidingtabstrip

q805699513 / Pagerslidingtabstrip

Licence: apache-2.0
一款android指示器TabLayout、PagerSlidingTabStrip,仿Boss直聘,带有红点未读提示

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Pagerslidingtabstrip

Coordinatortablayout
Combination of TabLayout and CoordinatorLayout./TabLayout和CoordinatorLayout相结合的折叠控件
Stars: ✭ 4,114 (+2606.58%)
Mutual labels:  tablayout
Viewpagerhelper
这个一个 viewpager/viewpager2工具类,能够帮你快速实现导航栏轮播图,app引导页,viewpager/viewpager2 + fragment;内置多种tab指示器,让你告别 viewpager 的繁琐操作,专注逻辑功能
Stars: ✭ 957 (+529.61%)
Mutual labels:  tablayout
Mao Rn Android Kit
⚙️ Android Native (ui components and modules) wrap in React Native
Stars: ✭ 74 (-51.32%)
Mutual labels:  tablayout
Coder
Android Material Design 风格控件的学习及遇到的问题;Tablayout | 横向布局标签,TextInputLayout | 文字输入布局 ,FloatingActionButton | 悬浮按钮, CoordinatorLayout APPBarLayout CollapsingTabLayout实现折叠头布局,BottomSheetDialog | 底部对话框,Touch Feedback| 触摸反馈,Reveal Effect| 揭示效果,Curved motion | 曲线运动,Animated Vector Drawables | 矢量图片动画
Stars: ✭ 502 (+230.26%)
Mutual labels:  tablayout
Multisearchview
Yet another built-in animated search view for Android.
Stars: ✭ 837 (+450.66%)
Mutual labels:  tablayout
Verticaltablayout
垂直纵向的TabLayout、轻松创建纵向导航
Stars: ✭ 1,088 (+615.79%)
Mutual labels:  tablayout
Playtablayout
PlayTabLayout is a tab layout very similar to Google Play tab layout. The main feature is that ripple shows in a particular place where user taps.
Stars: ✭ 319 (+109.87%)
Mutual labels:  tablayout
Whatsappviewpager
Swipeable tabs like WhatsApp in Android
Stars: ✭ 115 (-24.34%)
Mutual labels:  tablayout
Funtablayout
An efficient tablayout for Android with added FUN!
Stars: ✭ 20 (-86.84%)
Mutual labels:  tablayout
Materialdesign
Material Design 控件集合。ConstraintLayout、NestedScrollView、Toolbar、TabLayout、TextInputLayout。。。
Stars: ✭ 68 (-55.26%)
Mutual labels:  tablayout
Snaptablayout
Android library for fluid tablayout animation as seen on Snapchat.
Stars: ✭ 547 (+259.87%)
Mutual labels:  tablayout
Materialdesignsamples
Material Design 系列控件samples,讲了Material Design 系列新控件的使用方法和一些场景示例,使用详情请看对应博客,持续更新中...
Stars: ✭ 900 (+492.11%)
Mutual labels:  tablayout
Studynote
Be ready for work
Stars: ✭ 60 (-60.53%)
Mutual labels:  tablayout
Dsltablayout
♥️ Android界最万能的TabLayout(不仅仅是TabLayout), 支持任意类型的item, 支持Drawable类型的指示器,智能开启滚动,支持横竖向布局等
Stars: ✭ 489 (+221.71%)
Mutual labels:  tablayout
Magicindicator
A powerful, customizable and extensible ViewPager indicator framework. As the best alternative of ViewPagerIndicator, TabLayout and PagerSlidingTabStrip —— 强大、可定制、易扩展的 ViewPager 指示器框架。是ViewPagerIndicator、TabLayout、PagerSlidingTabStrip的最佳替代品。支持角标,更支持在非ViewPager场景下使用(使用hide()、show()切换Fragment或使用setVisibility切换FrameLayout里的View等),http://www.jianshu…
Stars: ✭ 8,969 (+5800.66%)
Mutual labels:  tablayout
Changetablayout
[停止维护]一款炫酷的TabLayout
Stars: ✭ 345 (+126.97%)
Mutual labels:  tablayout
Legacytableview
simple light weight android library for displaying tabulated data
Stars: ✭ 39 (-74.34%)
Mutual labels:  tablayout
Universal Collapsingtablayout
CollapsingToolbarLayout with TabLayout
Stars: ✭ 118 (-22.37%)
Mutual labels:  tablayout
Tabbar
🔥空祖家的导航栏工具
Stars: ✭ 100 (-34.21%)
Mutual labels:  tablayout
Android Tab Animation
Easily create TabLayout.Tab animations that sync with the scrolling progress of ViewPager
Stars: ✭ 68 (-55.26%)
Mutual labels:  tablayout

PagerSlidingTabStrip

一款android指示器TabLayout、PagerSlidingTabStrip,仿Boss直聘,带有红点未读提示

Example

   

Usage

Gradle

dependencies {
 //稳定版(推荐)没特殊需求建议使用官方TabLayout控件
 compile 'com.longsh:PagerSlidingTabStrip:1.0.0'
 //测试版
 compile 'com.longsh:PagerSlidingTabStrip:1.0.1'
}

使用

    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager()));
    tabs.setViewPager(pager);
    //pager.setOffscreenPageLimit(6);
    //设置参数
    setTabsValue();
    
     //例:设置第三个tab小红点显示,item从0开始计算,true为显示,false为隐藏,默认为全部隐藏
      //tabs.setMsgToast(2, true);
      
    //MyPagerAdapter为普通的FragmentPagerAdapter
    public class MyPagerAdapter extends FragmentPagerAdapter {...}
    

设置参数setTabsValue();

    private void setTabsValue() {
          DisplayMetrics dm = getResources().getDisplayMetrics();
          // 设置Tab底部选中的指示器Indicator的高度
          tabs.setIndicatorHeight(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2.5f, dm));
          // 设置Tab底部选中的指示器 Indicator的颜色
          tabs.setIndicatorColorResource(R.color.colorPrimary);
          //设置指示器Indicatorin是否跟文本一样宽,默认false
          tabs.setIndicatorinFollowerTv(false);
          //设置小红点提示,item从0开始计算,true为显示,false为隐藏,默认为全部隐藏
      //    tabs.setMsgToast(2, true);
          //设置红点滑动到当前页面自动消失,默认为true
          tabs.setMsgToastPager(true);
          //设置Tab标题文字的颜色
          //tabs.setTextColor(R.color.***);
          // 设置Tab标题文字的大小
          tabs.setTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 15, dm));
          // 设置选中的Tab文字的颜色
          tabs.setSelectedTextColorResource(R.color.colorPrimary);
          //设置Tab底部分割线的高度
          tabs.setUnderlineHeight(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1f, dm));
          //设置Tab底部分割线的颜色
          //tabs.setUnderlineColorResource(R.color.colorGray);
          // 设置点击某个Tab时的背景色,设置为0时取消背景色tabs.setTabBackground(0);
      //        tabs.setTabBackground(R.drawable.bg_tab);
          tabs.setTabBackground(0);
          // 设置Tab是自动填充满屏幕的
          tabs.setShouldExpand(true);

          //设置标签是否需要滑动,多个tab文字不够一屏显示的时候使用,后面会改成内部自动判断-----------------------------------------//todo
         //必须设置,1.0.0不需要设置这行
         tabs.setTabsScroll(true);
   }

XML布局代码

 <com.longsh.longshlibrary.PagerSlidingTabStrip
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        />
        
    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

如果你需要监听viewpager的滑动状态setOnPageChangeListener

    tabs.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }

        @Override
        public void onPageSelected(int position) {
           //if (position == 2) {
                //手动隐藏第二个小红点,tabs.setMsgToastPager(false);该方法为false时才需要手动隐藏。
                //tabs.setMsgToast(2, false);
           //}
        }
        
        @Override
        public void onPageScrollStateChanged(int state) {

        }
    });

使用参考类

使用参考类

Version: 1.0.1

//修复1.0.0文字自适应宽度  新增tabs.setTabsScroll(true);设置标签是否需要滑动,多个tab文字不够一屏显示的时候使用 todo //后续有时间会弄成内部自动判断。

Version: 1.0.0

 有其他需求可以给我提Issues,我在res/layout/布局里面设置了android:maxLength="5",限制每个tab最多显示5个字符,如果超过了5个字符的请下载源码去掉这行。

Thanks

License

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