├── .classpath
├── .project
├── .settings
└── org.eclipse.jdt.core.prefs
├── AndroidManifest.xml
├── README.md
├── bin
├── AndroidManifest.xml
├── IndicatorTabBar.apk
├── classes.dex
├── classes
│ └── com
│ │ └── andy
│ │ ├── indicatortabbar
│ │ ├── BuildConfig.class
│ │ ├── MainActivity$ViewPagerAdapter.class
│ │ ├── MainActivity.class
│ │ ├── R$attr.class
│ │ ├── R$color.class
│ │ ├── R$dimen.class
│ │ ├── R$drawable.class
│ │ ├── R$id.class
│ │ ├── R$integer.class
│ │ ├── R$layout.class
│ │ ├── R$menu.class
│ │ ├── R$string.class
│ │ ├── R$style.class
│ │ ├── R$styleable.class
│ │ ├── R.class
│ │ └── TestFragment.class
│ │ └── widgets
│ │ ├── IndicatorTabBar$1.class
│ │ ├── IndicatorTabBar$2.class
│ │ ├── IndicatorTabBar$OnTabSelectedListener.class
│ │ ├── IndicatorTabBar$TabContainer.class
│ │ ├── IndicatorTabBar$TabView.class
│ │ └── IndicatorTabBar.class
├── dexedLibs
│ └── android-support-v4-50335f90b7806da3179aef7f817127c5.jar
├── res
│ └── crunch
│ │ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ │ └── drawable-mdpi
│ │ └── ic_launcher.png
└── resources.ap_
├── gen
└── com
│ └── andy
│ └── indicatortabbar
│ ├── BuildConfig.java
│ └── R.java
├── ic_launcher-web.png
├── images
└── demo.jpg
├── libs
└── android-support-v4.jar
├── proguard-project.txt
├── project.properties
├── res
├── drawable-hdpi
│ └── ic_launcher.png
├── drawable-mdpi
│ └── ic_launcher.png
├── layout
│ └── activity_main.xml
├── menu
│ └── main.xml
├── values-sw600dp
│ └── dimens.xml
├── values-sw720dp-land
│ └── dimens.xml
├── values-v11
│ └── styles.xml
├── values-v14
│ └── styles.xml
└── values
│ ├── attrs.xml
│ ├── colors.xml
│ ├── default.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
└── src
└── com
└── andy
├── indicatortabbar
├── MainActivity.java
└── TestFragment.java
└── widgets
└── IndicatorTabBar.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | IndicatorTabBar
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3 | org.eclipse.jdt.core.compiler.compliance=1.6
4 | org.eclipse.jdt.core.compiler.source=1.6
5 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # IndicatorTabBar for Android
3 |
4 | ## How to use
5 |
6 | If you want use this view, the operation is as follows:
7 |
8 | Because the IndicatorTabBar has custom attributes, if you want use them, you must add your own namespace in your xml file in the first component:
9 |
10 | ```xml
11 |
17 |
18 |
19 | ```
20 |
21 | Then, add it into your layout file, to use the IndicatorTabBar:
22 | ```xml
23 |
31 | ```
32 |
33 | ##Demo
34 | 
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/bin/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/bin/IndicatorTabBar.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/IndicatorTabBar.apk
--------------------------------------------------------------------------------
/bin/classes.dex:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes.dex
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/BuildConfig.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/MainActivity$ViewPagerAdapter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/MainActivity$ViewPagerAdapter.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/MainActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/MainActivity.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/R$attr.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/R$color.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/R$color.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/R$dimen.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/R$dimen.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/R$drawable.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/R$id.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/R$integer.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/R$integer.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/R$layout.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/R$menu.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/R$menu.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/R$string.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/R$style.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/R$style.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/R$styleable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/R$styleable.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/R.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/indicatortabbar/TestFragment.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/indicatortabbar/TestFragment.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/widgets/IndicatorTabBar$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/widgets/IndicatorTabBar$1.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/widgets/IndicatorTabBar$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/widgets/IndicatorTabBar$2.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/widgets/IndicatorTabBar$OnTabSelectedListener.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/widgets/IndicatorTabBar$OnTabSelectedListener.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/widgets/IndicatorTabBar$TabContainer.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/widgets/IndicatorTabBar$TabContainer.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/widgets/IndicatorTabBar$TabView.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/widgets/IndicatorTabBar$TabView.class
--------------------------------------------------------------------------------
/bin/classes/com/andy/widgets/IndicatorTabBar.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/classes/com/andy/widgets/IndicatorTabBar.class
--------------------------------------------------------------------------------
/bin/dexedLibs/android-support-v4-50335f90b7806da3179aef7f817127c5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/dexedLibs/android-support-v4-50335f90b7806da3179aef7f817127c5.jar
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/res/crunch/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/res/crunch/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/resources.ap_:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/bin/resources.ap_
--------------------------------------------------------------------------------
/gen/com/andy/indicatortabbar/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package com.andy.indicatortabbar;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/gen/com/andy/indicatortabbar/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package com.andy.indicatortabbar;
9 |
10 | public final class R {
11 | public static final class attr {
12 | /**
Must be an integer value, such as "100
".
13 |
This may also be a reference to a resource (in the form
14 | "@[package:]type:name
") or
15 | theme attribute (in the form
16 | "?[package:][type:]name
")
17 | containing a value of this type.
18 | */
19 | public static final int tab_max_column=0x7f010005;
20 | /**
Must be a color value, in the form of "#rgb
", "#argb
",
21 | "#rrggbb
", or "#aarrggbb
".
22 |
This may also be a reference to a resource (in the form
23 | "@[package:]type:name
") or
24 | theme attribute (in the form
25 | "?[package:][type:]name
")
26 | containing a value of this type.
27 | */
28 | public static final int tab_text_color=0x7f010001;
29 | /**
Must be a color value, in the form of "#rgb
", "#argb
",
30 | "#rrggbb
", or "#aarrggbb
".
31 |
This may also be a reference to a resource (in the form
32 | "@[package:]type:name
") or
33 | theme attribute (in the form
34 | "?[package:][type:]name
")
35 | containing a value of this type.
36 | */
37 | public static final int tab_text_selected_color=0x7f010002;
38 | /**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
39 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
40 | in (inches), mm (millimeters).
41 |
This may also be a reference to a resource (in the form
42 | "@[package:]type:name
") or
43 | theme attribute (in the form
44 | "?[package:][type:]name
")
45 | containing a value of this type.
46 | */
47 | public static final int tab_text_size=0x7f010000;
48 | /**
Must be a color value, in the form of "#rgb
", "#argb
",
49 | "#rrggbb
", or "#aarrggbb
".
50 |
This may also be a reference to a resource (in the form
51 | "@[package:]type:name
") or
52 | theme attribute (in the form
53 | "?[package:][type:]name
")
54 | containing a value of this type.
55 | */
56 | public static final int tab_underline_color=0x7f010003;
57 | /**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
58 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
59 | in (inches), mm (millimeters).
60 |
This may also be a reference to a resource (in the form
61 | "@[package:]type:name
") or
62 | theme attribute (in the form
63 | "?[package:][type:]name
")
64 | containing a value of this type.
65 | */
66 | public static final int tab_underline_height=0x7f010004;
67 | }
68 | public static final class color {
69 | public static final int bg_color=0x7f040000;
70 | public static final int tab_text_color=0x7f040001;
71 | public static final int tab_text_selected_color=0x7f040002;
72 | public static final int tab_underline_color=0x7f040003;
73 | }
74 | public static final class dimen {
75 | /** Default screen margins, per the Android Design guidelines.
76 |
77 | Customize dimensions originally defined in res/values/dimens.xml (such as
78 | screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
79 |
80 | */
81 | public static final int activity_horizontal_margin=0x7f050002;
82 | public static final int activity_vertical_margin=0x7f050003;
83 | /** IndicatorTabBar's Default Value
84 | */
85 | public static final int tab_text_size=0x7f050000;
86 | public static final int tab_underline_height=0x7f050001;
87 | }
88 | public static final class drawable {
89 | public static final int ic_launcher=0x7f020000;
90 | }
91 | public static final class id {
92 | public static final int action_settings=0x7f0a0002;
93 | public static final int tab_indicator=0x7f0a0000;
94 | public static final int viewpager=0x7f0a0001;
95 | }
96 | public static final class integer {
97 | public static final int tab_max_column=0x7f060000;
98 | }
99 | public static final class layout {
100 | public static final int activity_main=0x7f030000;
101 | }
102 | public static final class menu {
103 | public static final int main=0x7f090000;
104 | }
105 | public static final class string {
106 | public static final int action_settings=0x7f070001;
107 | public static final int app_name=0x7f070000;
108 | public static final int hello_world=0x7f070002;
109 | }
110 | public static final class style {
111 | /**
112 | Base application theme, dependent on API level. This theme is replaced
113 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
114 |
115 |
116 | Theme customizations available in newer API levels can go in
117 | res/values-vXX/styles.xml, while customizations related to
118 | backward-compatibility can go here.
119 |
120 |
121 | Base application theme for API 11+. This theme completely replaces
122 | AppBaseTheme from res/values/styles.xml on API 11+ devices.
123 |
124 | API 11 theme customizations can go here.
125 |
126 | Base application theme for API 14+. This theme completely replaces
127 | AppBaseTheme from BOTH res/values/styles.xml and
128 | res/values-v11/styles.xml on API 14+ devices.
129 |
130 | API 14 theme customizations can go here.
131 | */
132 | public static final int AppBaseTheme=0x7f080000;
133 | /** Application theme.
134 | All customizations that are NOT specific to a particular API-level can go here.
135 | */
136 | public static final int AppTheme=0x7f080001;
137 | }
138 | public static final class styleable {
139 | /** IndicatorTabBar Attribute
140 |
Includes the following attributes:
141 |
142 |
143 |
144 | Attribute | Description |
145 | {@link #IndicatorTabBar_tab_max_column com.andy.indicatortabbar:tab_max_column} | |
146 | {@link #IndicatorTabBar_tab_text_color com.andy.indicatortabbar:tab_text_color} | |
147 | {@link #IndicatorTabBar_tab_text_selected_color com.andy.indicatortabbar:tab_text_selected_color} | |
148 | {@link #IndicatorTabBar_tab_text_size com.andy.indicatortabbar:tab_text_size} | |
149 | {@link #IndicatorTabBar_tab_underline_color com.andy.indicatortabbar:tab_underline_color} | |
150 | {@link #IndicatorTabBar_tab_underline_height com.andy.indicatortabbar:tab_underline_height} | |
151 |
152 | @see #IndicatorTabBar_tab_max_column
153 | @see #IndicatorTabBar_tab_text_color
154 | @see #IndicatorTabBar_tab_text_selected_color
155 | @see #IndicatorTabBar_tab_text_size
156 | @see #IndicatorTabBar_tab_underline_color
157 | @see #IndicatorTabBar_tab_underline_height
158 | */
159 | public static final int[] IndicatorTabBar = {
160 | 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
161 | 0x7f010004, 0x7f010005
162 | };
163 | /**
164 | This symbol is the offset where the {@link com.andy.indicatortabbar.R.attr#tab_max_column}
165 | attribute's value can be found in the {@link #IndicatorTabBar} array.
166 |
167 |
168 |
Must be an integer value, such as "100
".
169 |
This may also be a reference to a resource (in the form
170 | "@[package:]type:name
") or
171 | theme attribute (in the form
172 | "?[package:][type:]name
")
173 | containing a value of this type.
174 | @attr name com.andy.indicatortabbar:tab_max_column
175 | */
176 | public static final int IndicatorTabBar_tab_max_column = 5;
177 | /**
178 |
This symbol is the offset where the {@link com.andy.indicatortabbar.R.attr#tab_text_color}
179 | attribute's value can be found in the {@link #IndicatorTabBar} array.
180 |
181 |
182 |
Must be a color value, in the form of "#rgb
", "#argb
",
183 | "#rrggbb
", or "#aarrggbb
".
184 |
This may also be a reference to a resource (in the form
185 | "@[package:]type:name
") or
186 | theme attribute (in the form
187 | "?[package:][type:]name
")
188 | containing a value of this type.
189 | @attr name com.andy.indicatortabbar:tab_text_color
190 | */
191 | public static final int IndicatorTabBar_tab_text_color = 1;
192 | /**
193 |
This symbol is the offset where the {@link com.andy.indicatortabbar.R.attr#tab_text_selected_color}
194 | attribute's value can be found in the {@link #IndicatorTabBar} array.
195 |
196 |
197 |
Must be a color value, in the form of "#rgb
", "#argb
",
198 | "#rrggbb
", or "#aarrggbb
".
199 |
This may also be a reference to a resource (in the form
200 | "@[package:]type:name
") or
201 | theme attribute (in the form
202 | "?[package:][type:]name
")
203 | containing a value of this type.
204 | @attr name com.andy.indicatortabbar:tab_text_selected_color
205 | */
206 | public static final int IndicatorTabBar_tab_text_selected_color = 2;
207 | /**
208 |
This symbol is the offset where the {@link com.andy.indicatortabbar.R.attr#tab_text_size}
209 | attribute's value can be found in the {@link #IndicatorTabBar} array.
210 |
211 |
212 |
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
213 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
214 | in (inches), mm (millimeters).
215 |
This may also be a reference to a resource (in the form
216 | "@[package:]type:name
") or
217 | theme attribute (in the form
218 | "?[package:][type:]name
")
219 | containing a value of this type.
220 | @attr name com.andy.indicatortabbar:tab_text_size
221 | */
222 | public static final int IndicatorTabBar_tab_text_size = 0;
223 | /**
224 |
This symbol is the offset where the {@link com.andy.indicatortabbar.R.attr#tab_underline_color}
225 | attribute's value can be found in the {@link #IndicatorTabBar} array.
226 |
227 |
228 |
Must be a color value, in the form of "#rgb
", "#argb
",
229 | "#rrggbb
", or "#aarrggbb
".
230 |
This may also be a reference to a resource (in the form
231 | "@[package:]type:name
") or
232 | theme attribute (in the form
233 | "?[package:][type:]name
")
234 | containing a value of this type.
235 | @attr name com.andy.indicatortabbar:tab_underline_color
236 | */
237 | public static final int IndicatorTabBar_tab_underline_color = 3;
238 | /**
239 |
This symbol is the offset where the {@link com.andy.indicatortabbar.R.attr#tab_underline_height}
240 | attribute's value can be found in the {@link #IndicatorTabBar} array.
241 |
242 |
243 |
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
244 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
245 | in (inches), mm (millimeters).
246 |
This may also be a reference to a resource (in the form
247 | "@[package:]type:name
") or
248 | theme attribute (in the form
249 | "?[package:][type:]name
")
250 | containing a value of this type.
251 | @attr name com.andy.indicatortabbar:tab_underline_height
252 | */
253 | public static final int IndicatorTabBar_tab_underline_height = 4;
254 | };
255 | }
256 |
--------------------------------------------------------------------------------
/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/ic_launcher-web.png
--------------------------------------------------------------------------------
/images/demo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/images/demo.jpg
--------------------------------------------------------------------------------
/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-21
15 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
16 |
17 |
22 |
23 |
--------------------------------------------------------------------------------
/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FAFAFA
4 |
5 |
--------------------------------------------------------------------------------
/res/values/default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 15sp
6 |
7 | #AFAFAF
8 | #EE6E6C
9 | #FA3E41
10 |
11 | 8px
12 |
13 | 3
14 |
15 |
--------------------------------------------------------------------------------
/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | IndicatorTabBar
5 | Settings
6 | Hello world!
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/com/andy/indicatortabbar/MainActivity.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ASPOOK/IndicatorTabBar/4f32ab309453fd81519f3f9b9600b25a77395dcf/src/com/andy/indicatortabbar/MainActivity.java
--------------------------------------------------------------------------------
/src/com/andy/indicatortabbar/TestFragment.java:
--------------------------------------------------------------------------------
1 | package com.andy.indicatortabbar;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.view.Gravity;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.LinearLayout;
11 | import android.widget.TextView;
12 |
13 | public class TestFragment extends Fragment {
14 |
15 | private static final String KEY_CONTENT = "TestFragment:Content";
16 | private String mContent = "";
17 |
18 | public static TestFragment newInstance(String content) {
19 | TestFragment fragment = new TestFragment();
20 | fragment.mContent = content;
21 | return fragment;
22 | }
23 |
24 | @Override
25 | public void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | if ((savedInstanceState != null) && savedInstanceState.containsKey(KEY_CONTENT)) {
28 | mContent = savedInstanceState.getString(KEY_CONTENT);
29 | }
30 | }
31 |
32 | @Override
33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
34 | TextView text = new TextView(getActivity());
35 | text.setGravity(Gravity.CENTER);
36 | text.setText(mContent);
37 | text.setTextSize(10 * getResources().getDisplayMetrics().density);
38 | text.setTextColor(Color.GRAY);
39 | text.setPadding(20, 20, 20, 20);
40 |
41 | LinearLayout layout = new LinearLayout(getActivity());
42 | layout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
43 | LinearLayout.LayoutParams.MATCH_PARENT));
44 | layout.setGravity(Gravity.CENTER);
45 | layout.addView(text);
46 |
47 | return layout;
48 | }
49 |
50 | @Override
51 | public void onSaveInstanceState(Bundle outState) {
52 | super.onSaveInstanceState(outState);
53 | outState.putString(KEY_CONTENT, mContent);
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/com/andy/widgets/IndicatorTabBar.java:
--------------------------------------------------------------------------------
1 | package com.andy.widgets;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import com.andy.indicatortabbar.R;
7 | import android.content.Context;
8 | import android.content.res.TypedArray;
9 | import android.graphics.Canvas;
10 | import android.graphics.Color;
11 | import android.graphics.Paint;
12 | import android.graphics.Rect;
13 | import android.support.v4.view.ViewPager;
14 | import android.support.v4.view.ViewPager.OnPageChangeListener;
15 | import android.util.AttributeSet;
16 | import android.util.DisplayMetrics;
17 | import android.util.TypedValue;
18 | import android.view.Gravity;
19 | import android.view.MotionEvent;
20 | import android.view.WindowManager;
21 | import android.widget.FrameLayout;
22 | import android.widget.HorizontalScrollView;
23 | import android.widget.LinearLayout;
24 | import android.widget.TextView;
25 |
26 | /**
27 | * Indicator TabBar
28 | *
29 | * @author Andy
30 | * @since 2015-05-12
31 | *
32 | * Thanks for https://github.com/keithellis/MaterialWidget
33 | */
34 | public class IndicatorTabBar extends HorizontalScrollView {
35 |
36 | private int mMaxColumn;
37 | private static final int Default_Column = 3;
38 |
39 | private int mTextSize;
40 | private int mTextColor;
41 | private int mTextSelectedColor;
42 |
43 | private int mUnderLineColor;
44 | private int mUnderLineHeight;
45 |
46 | private TabContainer mTabContainer;
47 | private TabView mCurrentTab;
48 | private List mTabList = new ArrayList();
49 | private Rect lineRect = new Rect();
50 | private Paint linePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
51 |
52 | /** the ViewPager used with the IndicatorTabBar, not necessary, you could use the IndicatorTabBar individually */
53 | private ViewPager mViewPager;
54 |
55 | public IndicatorTabBar(Context context) {
56 | this(context, null);
57 | }
58 |
59 | public IndicatorTabBar(Context context, AttributeSet attrs) {
60 | this(context, attrs, 0);
61 | }
62 |
63 | public IndicatorTabBar(Context context, AttributeSet attrs, int defStyle) {
64 | super(context, attrs, defStyle);
65 | // TODO Auto-generated constructor stub
66 | setFillViewport(true);
67 |
68 | mTabContainer = new TabContainer(context);
69 | mTabContainer.setLayoutParams(new LayoutParams(
70 | LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
71 | mTabContainer.setOrientation(LinearLayout.HORIZONTAL);// default
72 | addView(mTabContainer);
73 |
74 | TypedArray attributes = context.obtainStyledAttributes(attrs,
75 | R.styleable.IndicatorTabBar);
76 | mTextSize = attributes.getDimensionPixelSize(
77 | R.styleable.IndicatorTabBar_tab_text_size, getResources()
78 | .getDimensionPixelSize(R.dimen.tab_text_size));
79 |
80 | mTextColor = attributes.getColor(
81 | R.styleable.IndicatorTabBar_tab_text_color, getResources()
82 | .getColor(R.color.tab_text_color));
83 | mTextSelectedColor = attributes.getColor(
84 | R.styleable.IndicatorTabBar_tab_text_selected_color,
85 | getResources().getColor(R.color.tab_text_selected_color));
86 |
87 | mUnderLineColor = attributes.getColor(
88 | R.styleable.IndicatorTabBar_tab_underline_color, getResources()
89 | .getColor(R.color.tab_underline_color));
90 | mUnderLineHeight = attributes.getDimensionPixelSize(
91 | R.styleable.IndicatorTabBar_tab_underline_height, getResources()
92 | .getDimensionPixelSize(R.dimen.tab_underline_height));
93 |
94 | mMaxColumn = attributes.getInteger(
95 | R.styleable.IndicatorTabBar_tab_max_column, getResources()
96 | .getInteger(R.integer.tab_max_column));
97 |
98 | attributes.recycle();
99 |
100 | linePaint.setStyle(Paint.Style.FILL);
101 | }
102 |
103 | public void initView(List tabNames) {
104 | if (tabNames != null && tabNames.size() > 0) {
105 | initView(tabNames, mMaxColumn);
106 | }
107 | }
108 |
109 | public void initView(List tabNames, int maxColumn) {
110 | if (maxColumn <= 0) {
111 | maxColumn = Default_Column;
112 | }
113 | int tabCount = tabNames.size();
114 | int screenWidth = getScreenWidth(getContext());
115 | //Divide equally
116 | final int tabWidth = Math.round(screenWidth / maxColumn);
117 |
118 | for (int i = 0; i < tabCount; i++) {
119 | addTabView(i, tabWidth, tabNames.get(i));
120 | }
121 |
122 | if (mViewPager != null) {
123 | mViewPager.setOnPageChangeListener(new OnPageChangeListener() {
124 |
125 | @Override
126 | public void onPageSelected(int position) {
127 | // The IndicatorTabBar's ScrollX and ScrollY both are 0 at first.
128 | setTabSelected(position);
129 | if (position >= mMaxColumn / 2) {
130 | smoothScrollTo((position - (mMaxColumn / 2)) * tabWidth, 0);
131 | }
132 | }
133 |
134 | @Override
135 | public void onPageScrolled(int arg0, float arg1, int arg2) {
136 | // TODO Auto-generated method stub
137 |
138 | }
139 |
140 | @Override
141 | public void onPageScrollStateChanged(int arg0) {
142 | // TODO Auto-generated method stub
143 |
144 | }
145 | });
146 | }
147 | }
148 |
149 | public void setMaxColumn(int column) {
150 | this.mMaxColumn = column;
151 | }
152 |
153 | public void setTextSize(int size) {
154 | this.mTextSize = size;
155 | }
156 |
157 | public void setTextColor(int color) {
158 | this.mTextColor = color;
159 | }
160 |
161 | public void setTextSelectedColor(int color) {
162 | this.mTextSelectedColor = color;
163 | }
164 |
165 | public void setUnderLineColor(int color) {
166 | this.mUnderLineColor = color;
167 | }
168 |
169 | public void setUnderLineHeight(int hight) {
170 | this.mUnderLineHeight = hight;
171 | }
172 |
173 | public void setViewPager(ViewPager viewPager) {
174 | this.mViewPager = viewPager;
175 | }
176 |
177 | /**
178 | * add the TabView to TabContainer
179 | * @param index tab's index
180 | * @param width tab's width
181 | * @param title tab's title
182 | */
183 | private void addTabView(final int index, int width, String title) {
184 | TabView tabView = new TabView(getContext());
185 | tabView.setIndex(index);
186 | tabView.setText(title);
187 | tabView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize);
188 | tabView.setTextColor(mTextColor);
189 | tabView.setWidth(width);
190 | tabView.setTabWidth(width);
191 |
192 | tabView.setOnTabSelectedListener(new OnTabSelectedListener() {
193 | @Override
194 | public void onTabSelected(TabView tabView) {
195 | tabView.getIndex();
196 | mCurrentTab = tabView;
197 | mTabContainer.postInvalidate();
198 |
199 | if (mViewPager != null) {
200 | mViewPager.setCurrentItem(index);
201 | }
202 | }
203 | });
204 |
205 | if (index == 0) {
206 | mCurrentTab = tabView;
207 | }
208 | mTabList.add(tabView);
209 | mTabContainer.addView(tabView, new LinearLayout.LayoutParams(
210 | FrameLayout.LayoutParams.WRAP_CONTENT,
211 | FrameLayout.LayoutParams.MATCH_PARENT));
212 | }
213 |
214 | /**
215 | * get the Screen Width in px
216 | * @param context
217 | * @return
218 | */
219 | public int getScreenWidth(Context context) {
220 | WindowManager wm = (WindowManager) context
221 | .getSystemService(Context.WINDOW_SERVICE);
222 | DisplayMetrics outMetrics = new DisplayMetrics();
223 | wm.getDefaultDisplay().getMetrics(outMetrics);
224 | return outMetrics.widthPixels;
225 | }
226 |
227 | /**
228 | * set which tab is selected ,used for viewpager when onPageSelected
229 | *
230 | * @param position
231 | */
232 | private void setTabSelected(int position) {
233 | if (mTabList != null) {
234 | TabView currentTabView = mTabList.get(position);
235 | if (currentTabView != null) {
236 | currentTabView.performSelectAction();
237 | }
238 | }
239 | }
240 |
241 | /**
242 | * Tab container which extends LinearLayout as a ViewGroup for adding TabView
243 | */
244 | private class TabContainer extends LinearLayout {
245 |
246 | public TabContainer(Context context) {
247 | this(context, null);
248 | }
249 |
250 | public TabContainer(Context context, AttributeSet attrs) {
251 | this(context, attrs, 0);
252 | }
253 |
254 | public TabContainer(Context context, AttributeSet attrs, int defStyle) {
255 | super(context, attrs, defStyle);
256 | setWillNotDraw(false);
257 | }
258 |
259 | @Override
260 | protected void onDraw(Canvas canvas) {
261 | super.onDraw(canvas);
262 | linePaint.setColor(mUnderLineColor);
263 |
264 | if (mCurrentTab != null) {
265 | for (TabView tabView : mTabList) {
266 | tabView.setTextColor(mTextColor);
267 | }
268 | mCurrentTab.setTextColor(mTextSelectedColor);
269 |
270 | int x = mCurrentTab.getIndex() * mCurrentTab.getTabWidth();
271 | lineRect.left = mCurrentTab.getIndex() * mCurrentTab.getTabWidth();
272 | lineRect.top = getHeight() - mUnderLineHeight;
273 | lineRect.right = x + mCurrentTab.getWidth();
274 | lineRect.bottom = getHeight();
275 |
276 | canvas.drawRect(lineRect, linePaint);
277 | }
278 | }
279 | }
280 |
281 | /**
282 | * Tab Item which extends TextView
283 | */
284 | private class TabView extends TextView {
285 |
286 | /** Tab's index */
287 | private int mIndex;
288 | /** Tab's width */
289 | private int mTabWidth;
290 |
291 | private OnTabSelectedListener mOnTabSelectedListener;
292 |
293 | public TabView(Context context) {
294 | this(context, null);
295 | }
296 |
297 | public TabView(Context context, AttributeSet attrs) {
298 | this(context, attrs, 0);
299 | }
300 |
301 | public TabView(Context context, AttributeSet attrs, int defStyle) {
302 | super(context, attrs, defStyle);
303 |
304 | setGravity(Gravity.CENTER);
305 | setBackgroundColor(Color.TRANSPARENT);
306 | }
307 |
308 | public int getIndex() {
309 | return mIndex;
310 | }
311 |
312 | public void setIndex(int index) {
313 | this.mIndex = index;
314 | }
315 |
316 | public int getTabWidth() {
317 | return mTabWidth;
318 | }
319 |
320 | public void setTabWidth(int width) {
321 | this.mTabWidth = width;
322 | }
323 |
324 | public void setOnTabSelectedListener(OnTabSelectedListener listener) {
325 | this.mOnTabSelectedListener = listener;
326 | }
327 |
328 | public void performSelectAction() {
329 | if (mOnTabSelectedListener != null) {
330 | mOnTabSelectedListener.onTabSelected(TabView.this);
331 | }
332 | }
333 |
334 | @Override
335 | public boolean onTouchEvent(MotionEvent event) {
336 | switch (event.getAction()) {
337 | case MotionEvent.ACTION_DOWN:
338 |
339 | break;
340 | case MotionEvent.ACTION_MOVE:
341 |
342 | break;
343 | case MotionEvent.ACTION_UP:
344 | performSelectAction();
345 | break;
346 | }
347 | return true;
348 | }
349 |
350 | }
351 |
352 | /**
353 | * the interface will response when a Tab is selected
354 | */
355 | public interface OnTabSelectedListener {
356 | void onTabSelected(TabView tabView);
357 | }
358 |
359 | }
360 |
--------------------------------------------------------------------------------