跳至主要内容

博文

目前显示的是标签为“TabStrip”的博文

[Widget]IndicatorTabStrip-移动式下标渐变缩放Tab

IndicatorTabStrip 继承自BaseTabStrip,移动式下标渐变缩放Tab,Item不建议超过5个,为ViewPager添加如PagerTitleStrip一样的Tab,但支持更多自定义功能,并支持为Tab增加标记点功能,并可以自定义标记点各自的位置及显示状态以及背景等。 预览 要求 minSdkVersion 9 保持跟其他官方支持库版本一致(如:com.android.support:appcompat-v7) 链接 Github Bintray 使用 基本布局 < am .widget.indicatortabstrip.IndicatorTabStrip xmlns : app = " http://schemas.android.com/apk/res-auto " android : id = " @+id/its_its_tabs " android : layout_width = " match_parent " android : layout_height = " ?attr/actionBarSize " android : padding = " 5dp " android : textColor = " @color/color_main_tabs " android : textSize = " 16sp " app : ttsTextScale = " 1.2 " app : ttsDivider = " @drawable/divider_indicator_under " app : ttsInterval = " @drawable/divider_indicator_interval " app : ttsIndicator = " @drawable/ic_indicator_indicator " ...

[Widget]TagTabStrip-ViewPager页面切换标记点

TagTabStrip 继承自BaseTabStrip,实现ViewPager标志小点,一般用于功能引导页面及新功能简介页,为ViewPager添加标志小点,并不仅限于小点,标志由设置的Drawable决定,普通模式为双Drawable交替模式,亦可设置为单Drawable缩放模式。 一般用于仅仅是几张图的功能展示页面,实现原理也很简单,仅仅是将选中与普通情况下的图片进行不同alpha叠加。一般来说其不存在点击事件,于是其不拦截触摸事件。因实现了ViewPager的隐藏子项接口,也就是可作为子项直接贴在ViewPager布局内部,但ViewPager限制了只能显示在顶部或者底部。 预览 要求 minSdkVersion 9 保持跟其他官方支持库版本一致(如:com.android.support:appcompat-v7) 链接 Github Bintray 使用 基本布局 < am .widget.tagtabstrip.TagTabStrip xmlns : app = " http://schemas.android.com/apk/res-auto " android : layout_width = " wrap_content " android : layout_height = " wrap_content " android : drawablePadding = " 6dp " android : gravity = " center " app : ttsScale = " 1.6 " app : ttsDrawable = " @drawable/ic_tag " /> 基本代码 TagTabStrip ttsTags = ( TagTabStrip ) findViewById(id); ttsTags . bindViewPager(viewpager); 注意 不要使用ViewPage的setCurrentItem(in...

[Widget]GradientTabStrip-微信式底部渐变栏

GradientTabStrip icon 继承自BaseTabStrip,实现微信式渐变底部Tab效果,为ViewPager添加如PagerTitleStrip一样的Tab,但支持更多自定义功能,并支持为Tab增加标记点功能,并可以自定义标记点各自的位置及显示状态以及背景等。 预览 screenshots 要求 minSdkVersion 9 保持跟其他官方支持库版本一致(如:com.android.support:appcompat-v7) 链接 Github Bintray 使用 基本布局 < 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 ; } @...

[Widget]BaseTabStrip-用于捆绑ViewPager实现复杂页面切换效果的TabStrip的基类

BaseTabStrip 支持库v4中本就存在控件PagerTitleStrip,但对于各式各样的需要,其还是满足不了。但每一种样式都重新写一些基础方法也浪费,于是将通用方法提出写成基类,而具体样式就交给子类实现。 BaseTabStrip继承自View,可自动捆绑ViewPager,为基础类,仅实现了一些通用基础逻辑。具体的实现效果需要实现与重写部分方法。 要求 minSdkVersion 9 保持跟其他官方支持库版本一致(如:com.android.support:appcompat-v7) 链接 Github Bintray 使用 必须实现的方法(实现子类独有的效果): /** * 直接跳转到 * * @param current 位置 */ protected abstract void jumpTo( int current); /** * 滑向左边 * * @param current 当前页 * @param next 目标页 * @param offset 偏移 */ protected abstract void gotoLeft( int current, int next, float offset); /** * 滑向右边 * * @param current 当前页 * @param next 目标页 * @param offset 偏移 */ protected abstract void gotoRight( int current, int next, float offset); 可重写的方法: 完成PagerAdapter绑定,但并未刷新界面及布局: /** * 捆绑PagerAdapter */ protected void onBindPagerAdapter() { } 若子类要实现点击事件,需要实现将点击的点转...