|
@@ -2,7 +2,11 @@ package com.reactnativenavigation.views;
|
2
|
2
|
|
3
|
3
|
import android.content.Context;
|
4
|
4
|
import android.content.res.ColorStateList;
|
|
5
|
+import android.graphics.Typeface;
|
5
|
6
|
import android.support.design.widget.TabLayout;
|
|
7
|
+import android.view.View;
|
|
8
|
+import android.view.ViewGroup;
|
|
9
|
+import android.widget.TextView;
|
6
|
10
|
|
7
|
11
|
import com.reactnativenavigation.params.StyleParams;
|
8
|
12
|
import com.reactnativenavigation.views.utils.TopTabsIconColorHelper;
|
|
@@ -39,6 +43,24 @@ public class TopTabs extends TabLayout {
|
39
|
43
|
setTabTextColors(tabTextColor, selectedTabColor);
|
40
|
44
|
}
|
41
|
45
|
|
|
46
|
+ void setTopTabsTextFontFamily(StyleParams style) {
|
|
47
|
+ if (style.topTabTextFontFamily.hasFont()) {
|
|
48
|
+ ViewGroup viewGroup = (ViewGroup) this.getChildAt(0);
|
|
49
|
+
|
|
50
|
+ for (int tab = 0; tab < viewGroup.getChildCount(); tab++) {
|
|
51
|
+ ViewGroup tabViewGroup = (ViewGroup) viewGroup.getChildAt(tab);
|
|
52
|
+
|
|
53
|
+ for (int i = 0; i < tabViewGroup.getChildCount(); i++) {
|
|
54
|
+ View tabViewChild = tabViewGroup.getChildAt(i);
|
|
55
|
+ if (tabViewChild instanceof TextView) {
|
|
56
|
+ ((TextView) tabViewChild).setTypeface(
|
|
57
|
+ style.topTabTextFontFamily.get(), Typeface.NORMAL);
|
|
58
|
+ }
|
|
59
|
+ }
|
|
60
|
+ }
|
|
61
|
+ }
|
|
62
|
+ }
|
|
63
|
+
|
42
|
64
|
void setScrollable(StyleParams style) {
|
43
|
65
|
if (style.topTabsScrollable) {
|
44
|
66
|
setTabMode(TabLayout.MODE_SCROLLABLE);
|