1

I have five tabs (Events, Groups, Devices, Map, and More) in a tabgroup component on Android using Titanium. I don't want the user to have to scroll horizontally to see these tabs on common, larger android devices.

If I can change the minimum width or padding of a tab, they would easily fit and still be plenty large enough to tap on.

I need to change these style attributes on the Titanium component somehow:

android.support.design:tabMinWidth android.support.design:tabPaddingStart

I can't figure out how. I see how to create a theme but I don't see how to modify all tablayout components using a theme.

I see that if I had access to the underlying native component I could change the padding doing something like this:

int tabIndex = 0; 
LinearLayout layout = ((LinearLayout)((LinearLayout)mTabLayout.getChildAt(0)).getChildAt(tabIndex)); 
layout.setPadding(0,0, 0, 0);

But of course I have no idea how I would do that within the Titanium framework.

Any ideas would be appreciated?

Rene Pot
  • 24,681
  • 7
  • 68
  • 92
  • May be this will help you ! http://stackoverflow.com/questions/33647330/cannot-remove-padding-from-tabs-when-using-custom-views-with-tab-layout – iamnaran Sep 27 '16 at 01:30
  • Thanks for the comment! I am aware of tabPaddingStart/tabPaddingEnd but how do I apply them within Appcelerator Titanium? – Bravo Xavier Sep 27 '16 at 14:50

1 Answers1

0

You can use titanium platform folder to define Your custom styles your_project/app/platform/android/....

Here are described how to style: Styling Tab Widget's using XML

Community
  • 1
  • 1
Michael Bahl
  • 2,941
  • 1
  • 13
  • 16
  • I am aware that you can style the tab widget using XML to change its colors. I don't see how to change the padding as a style. Do you have an example? – Bravo Xavier Sep 27 '16 at 14:44