문제

I have a project that uses tabs in the Actionbar. When the app is turned to landscape mode, Android automatically switches those tabs into a spinner drop down. The spinner takes on the text color of the tabs, but I'd like to change that color. Ideally, I'd like to change the text color of the selected item that shows up in the action bar separate from the color that appears in the item list.

I've found solutions for doing this if you are creating the dropdown yourself, but I am not creating it myself, Android is doing it on its own. I've tried styling the spinner widget, but the one created from the tabs still seems to use the colors from the tab style instead of the spinner style.

도움이 되었습니까?

해결책

Unfortunately, the TextView that displays each of your tabs in the Spinner created by the ScrollingTabContainerView, inherits the actionBarTabTextStyle. So, you can't modify them individually.

Your best bet is to listen to orientation changes, then set the navigation mode of the ActionBar to ActionBar.NAVIGATION_MODE_LIST when you're in landscape, and bind your own SpinnerAdapter using ActionBar.setListNavigationCallbacks.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top