From 98f01f479e474a32289bb1f3b3e6a38dde370d99 Mon Sep 17 00:00:00 2001 From: vakrilov Date: Wed, 14 Oct 2015 15:22:45 +0300 Subject: [PATCH] Exposed getView methods for tab --- src/org/nativescript/widgets/TabLayout.java | 25 +++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/org/nativescript/widgets/TabLayout.java b/src/org/nativescript/widgets/TabLayout.java index 12afcdc38..b909f7c38 100644 --- a/src/org/nativescript/widgets/TabLayout.java +++ b/src/org/nativescript/widgets/TabLayout.java @@ -105,7 +105,7 @@ public class TabLayout extends HorizontalScrollView { /** * Set the custom {@link TabColorizer} to be used. * - * If you only require simple custmisation then you can use + * If you only require simple customisation then you can use * {@link #setSelectedIndicatorColors(int...)} to achieve similar effects. */ public void setCustomTabColorizer(TabColorizer tabColorizer) { @@ -158,7 +158,7 @@ public class TabLayout extends HorizontalScrollView { } /** - * Updates the ui of an item at specified index + * Updates the UI of an item at specified index */ public void updateItemAt(int position, TabItemSpec tabItem) { LinearLayout ll = (LinearLayout)mTabStrip.getChildAt(position); @@ -166,6 +166,27 @@ public class TabLayout extends HorizontalScrollView { TextView textView = (TextView)ll.getChildAt(1); this.setupItem(ll, textView, imgView, tabItem); } + + /** + * Gets the TextView for tab item at index + */ + public TextView getTextViewForItemAt(int index){ + LinearLayout ll = this.getViewForItemAt(index); + return (ll != null) ? (TextView)ll.getChildAt(1) : null; + } + + /** + * Gets the LinearLayout container for tab item at index + */ + public LinearLayout getViewForItemAt(int index){ + LinearLayout result = null; + + if(this.mTabStrip.getChildCount() > index){ + result = (LinearLayout)this.mTabStrip.getChildAt(index); + } + + return result; + } /** * Create a default view to be used for tabs.