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

Dev #507

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Dev #507

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
2 changes: 1 addition & 1 deletion FlycoTabLayout_Lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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:25+'
}

//def siteUrl = 'https://github.com/H07000223' // 项目的主页
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
private float mCurrentPositionOffset;
private int mTabCount;
/** 用于绘制显示器 */
private Rect mIndicatorRect = new Rect();
protected Rect mIndicatorRect = new Rect();
/** 用于实现滚动居中 */
private Rect mTabRect = new Rect();
private GradientDrawable mIndicatorDrawable = new GradientDrawable();
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.1.0'
// compile project(':FlycoTabLayout_Lib')
compile 'com.android.support:appcompat-v7:25+'
compile project(':FlycoTabLayout_Lib')

//--->support 3.0+
compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
// compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
//--->support 2.2+
// compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.0.0@aar'
// compile 'com.nineoldandroids:library:2.4.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ protected void onCreate(Bundle savedInstanceState) {
/** indicator圆角色块 */
SlidingTabLayout tabLayout_9 = ViewFindUtils.find(decorView, R.id.tl_9);
/** indicator圆角色块 */
SlidingTabLayout tabLayout_10 = ViewFindUtils.find(decorView, R.id.tl_10);
SlidingTabLayoutV2 tabLayout_10 = ViewFindUtils.find(decorView, R.id.tl_10);
tabLayout_10.setmIndicatorDrawable(getResources().getDrawable(R.drawable.icon_tablayout_indicator));

tabLayout_1.setViewPager(vp);
tabLayout_2.setViewPager(vp);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.flyco.tablayoutsamples.ui;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.util.AttributeSet;
import android.view.Gravity;

import com.flyco.tablayout.SlidingTabLayout;

public class SlidingTabLayoutV2 extends SlidingTabLayout {
public SlidingTabLayoutV2(Context context) {
super(context);
}

public SlidingTabLayoutV2(Context context, AttributeSet attrs) {
super(context, attrs);
}

public SlidingTabLayoutV2(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
private Drawable mIndicatorDrawable = new BitmapDrawable();

public void setmIndicatorDrawable(Drawable mIndicatorDrawable) {
this.mIndicatorDrawable = mIndicatorDrawable;
}

@Override
protected void onDraw(Canvas canvas) {
mIndicatorDrawable.setBounds(getPaddingLeft() + (int) getIndicatorMarginLeft() + mIndicatorRect.left,
getHeight() - 50,
getPaddingLeft() + mIndicatorRect.right - (int) getIndicatorMarginRight(),
getHeight() - (int) getIndicatorMarginBottom());

mIndicatorDrawable.draw(canvas);
super.onDraw(canvas);

}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable/background_card.9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions app/src/main/res/layout/activity_sliding_tab.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,19 @@
tl:tl_indicator_margin_right="2dp"
tl:tl_indicator_style="BLOCK"/>

<com.flyco.tablayout.SlidingTabLayout
<com.flyco.tablayoutsamples.ui.SlidingTabLayoutV2
android:id="@+id/tl_10"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#222831"
android:paddingLeft="5dp"
android:paddingRight="5dp"

tl:tl_indicator_color="#393E46"
tl:tl_indicator_corner_radius="5dp"
tl:tl_indicator_margin_left="2dp"
tl:tl_indicator_margin_right="2dp"
tl:tl_indicator_style="BLOCK"/>
/>

</LinearLayout>

Expand Down
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
Expand All @@ -16,6 +20,10 @@ buildscript {
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
// maven {
// url "http://dl.bintray.com/h07000223/maven"
// }
Expand Down