Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dividers between TabWidgets

Is the android:divider attribute under the TabWidget working? I tried the Tab Layout tutorial from android just to test (http://developer.android.com/resources/tutorials/views/hello-tabwidget.html) and set the android:divider to some image (for now I used the android vertical scrollbar as the drawable to really emphasize if its getting picked up (copied it from frameworks), but when I ran it on the emulator, it doesn't appear to be working. According to the docs, the TabWidget does seem to support this attribute: "Drawable used to draw the divider between tabs."

Can anyone help? I am using a nine-patched drawable as my divider image drawable.

MB

like image 426
mbethdev Avatar asked Nov 28 '22 03:11

mbethdev


1 Answers

It doesn't look like the divider attribute is available anymore for TabWidget. One way to add a custom divider is to set it programmatically:

mTabHost.getTabWidget().setDividerDrawable(R.drawable.divider_vertical_dark);

Make sure however, you call this before you set the content of the tabs. It would crash on me if I called it after.

like image 59
Josh Clemm Avatar answered Nov 30 '22 22:11

Josh Clemm