9
9
import android .view .View ;
10
10
import android .view .animation .AccelerateInterpolator ;
11
11
import android .view .animation .DecelerateInterpolator ;
12
+ import android .view .animation .OvershootInterpolator ;
12
13
import android .widget .LinearLayout ;
13
14
15
+ import net .lucode .hackware .magicindicator .FragmentContainerHelper ;
14
16
import net .lucode .hackware .magicindicator .MagicIndicator ;
15
17
import net .lucode .hackware .magicindicator .ViewPagerHelper ;
16
18
import net .lucode .hackware .magicindicator .buildins .UIUtil ;
@@ -211,6 +213,8 @@ public void onClick(View v) {
211
213
@ Override
212
214
public IPagerIndicator getIndicator (Context context ) {
213
215
LinePagerIndicator linePagerIndicator = new LinePagerIndicator (context );
216
+ linePagerIndicator .setMode (LinePagerIndicator .MODE_EXACTLY );
217
+ linePagerIndicator .setLineWidth (UIUtil .dip2px (context , 10 ));
214
218
linePagerIndicator .setColors (Color .WHITE );
215
219
return linePagerIndicator ;
216
220
}
@@ -224,6 +228,15 @@ public int getIntrinsicWidth() {
224
228
return UIUtil .dip2px (FixedTabExampleActivity .this , 15 );
225
229
}
226
230
});
227
- ViewPagerHelper .bind (magicIndicator , mViewPager );
231
+
232
+ final FragmentContainerHelper fragmentContainerHelper = new FragmentContainerHelper (magicIndicator );
233
+ fragmentContainerHelper .setInterpolator (new OvershootInterpolator (2.0f ));
234
+ fragmentContainerHelper .setDuration (300 );
235
+ mViewPager .addOnPageChangeListener (new ViewPager .SimpleOnPageChangeListener () {
236
+ @ Override
237
+ public void onPageSelected (int position ) {
238
+ fragmentContainerHelper .handlePageSelected (position );
239
+ }
240
+ });
228
241
}
229
242
}
0 commit comments