0

I'm working with AppCompat and I use the ActionBar.Tab to set Tab's and now I need to get Tab Height ?

Any help will be appreciated.

TooCool
  • 10,598
  • 15
  • 60
  • 85
  • try -- getHeight(); -- eg-- myTab.getHeight() – Tasos Sep 15 '15 at 23:26
  • @Tasos there is no getHeight() method defined for Tab – TooCool Sep 15 '15 at 23:28
  • Try if this works -tabHost.getTabWidget().getChildAt(index).getLayoutParams().height – Varundroid Sep 15 '15 at 23:44
  • ActionBar.Tab is deprecated. Please try using some other class like TabHost or PageTabStrip or PageTitleStrip. – Varundroid Sep 15 '15 at 23:47
  • what are you trying to do anyway, why do need to get the height? is your issue something like this -- http://stackoverflow.com/questions/13827762/actionbar-with-navigation-tabs-changes-height-with-screen-orientation – Tasos Sep 15 '15 at 23:48
  • @Varundroid I know that ActionBar.Tab is depricated but I don't have time to upgrade my app right now – TooCool Sep 15 '15 at 23:50

2 Answers2

0

You can use either

getToolbar().getHeight();

or if you're using the AppCompatActivity

getSupportActionBar().getHeight();

Assuming you've set the toolbar.

Cheers

Cyrus
  • 38
  • 3
0

try with :

   TabHost myTabHost= getTabHost(); 
   int tabHeight = myTabHost.getTabWidget().getHeight();
Jorgesys
  • 124,308
  • 23
  • 334
  • 268