Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 Enhancements #225

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions FlycoTabLayout_Lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ apply plugin: 'com.android.library'
//apply plugin: 'com.jfrog.bintray'

// 这个version是区分library版本的,因此当我们需要更新library时记得修改这个version
version = "2.1.2"
version = "2.1.3"
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
compileSdkVersion 26
buildToolsVersion "26.0.1"

defaultConfig {
minSdkVersion 11
targetSdkVersion 25
versionCode 212
targetSdkVersion 26
versionCode 213
versionName version
}
buildTypes {
Expand All @@ -24,7 +24,7 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:support-v4:26.1.0'
}

//def siteUrl = 'https://github.com/H07000223' // 项目的主页
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
private float mIndicatorMarginBottom;
private int mIndicatorGravity;
private boolean mIndicatorWidthEqualTitle;
private float mIndicatorWidthEqualTitleExtra;

/** underline */
private int mUnderlineColor;
Expand Down Expand Up @@ -146,6 +147,7 @@ private void obtainAttributes(Context context, AttributeSet attrs) {
mIndicatorMarginBottom = ta.getDimension(R.styleable.SlidingTabLayout_tl_indicator_margin_bottom, dp2px(mIndicatorStyle == STYLE_BLOCK ? 7 : 0));
mIndicatorGravity = ta.getInt(R.styleable.SlidingTabLayout_tl_indicator_gravity, Gravity.BOTTOM);
mIndicatorWidthEqualTitle = ta.getBoolean(R.styleable.SlidingTabLayout_tl_indicator_width_equal_title, false);
mIndicatorWidthEqualTitleExtraWidth = ta.getDimension(R.styleable.SlidingTabLayout_tl_indicator_width_equal_title_extra_width, dp2px(0));

mUnderlineColor = ta.getColor(R.styleable.SlidingTabLayout_tl_underline_color, Color.parseColor("#ffffff"));
mUnderlineHeight = ta.getDimension(R.styleable.SlidingTabLayout_tl_underline_height, dp2px(0));
Expand Down Expand Up @@ -413,8 +415,8 @@ private void calcIndicatorRect() {
mIndicatorRect.right = (int) right;
//for mIndicatorWidthEqualTitle
if (mIndicatorStyle == STYLE_NORMAL && mIndicatorWidthEqualTitle) {
mIndicatorRect.left = (int) (left + margin - 1);
mIndicatorRect.right = (int) (right - margin - 1);
mIndicatorRect.left = (int) ((left + margin - 1) - mIndicatorWidthEqualTitleExtraWidth);
mIndicatorRect.right = (int) ((right - margin - 1) + mIndicatorWidthEqualTitleExtraWidth);
}

mTabRect.left = (int) left;
Expand Down
2 changes: 2 additions & 0 deletions FlycoTabLayout_Lib/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
</attr>
<!-- 设置显示器长度与title一样长,只有在STYLE_NORMAL并且indicatorWidth小于零有效-->
<attr name="tl_indicator_width_equal_title" format="boolean"/>
<attr name="tl_indicator_width_equal_title_extra_width" format="dimension"/>
<!-- 设置显示器支持动画-->
<attr name="tl_indicator_anim_enable" format="boolean"/>
<!-- 设置显示器动画时间-->
Expand Down Expand Up @@ -90,6 +91,7 @@
<attr name="tl_indicator_gravity"/>
<attr name="tl_indicator_style"/>
<attr name="tl_indicator_width_equal_title"/>
<attr name="tl_indicator_width_equal_title_extra_width"/>

<!-- underline -->
<attr name="tl_underline_color"/>
Expand Down