Android 4.0 ActivityGroup and FrameLayout Tabs
-
27-06-2021 - |
質問
I have an app that uses an ActivityGroup and FrameLayout to show activities and tabs. Everything works fine on devices pre android 4.0. However, when using a device with 4.x the tabs are not showing. It's just a gray area.
Does anyone have any idea why this happens? I know that ActivityGroup is deprecated, but it should still be working on > 4.0 right? Or do you have to do it in another way? (the app is not worth changing everything to fragments)
I've included screens that shows what I mean.
Thanks! -Rob!
Edit; The app is using TabHost and TabWidget for this purpose. I didn't really clarify that.
解決
For you who are interested, I found a solution to my problem.
In the TabWidget
class (which extends LinearLayout
) I removed the overriding of the setDividerDrawable()
method. For some reason this method wasn't even called when running on devices < 4.0, thus having no impact on the application. But when running the app on a 4.0+ this method was called, and the divider was basically not set and the whole TabWidget
got screwed up.
Why this happens I have no idea, so if anyone knows why, please feel free to enlighten the rest of us :)
Hope this will help someone else too.
Cheers!