开发者

Android: Is it possible to have a scrollview in a flipper in a tabview?

I have a TabView and on its first tab I have a ViewFlipper displaying two pages of ImageButtons (say buttonsPage1 and buttonsPag开发者_Go百科e2).

When in landscape orientation, I need the image buttons pages to be scrollable, so I tried to add a ScrollView on buttonsPage1 and another on buttonsPage2. I get a StackOverflowError.

I tried then to suppress the ScrollView from the pageButtons1 and 2 and to include the ViewFlipper in a ScrollView. I got the same StackOverflowError.

If I completely remove the ViewFlipper, the applications runs as expected, no error occurs, only I DO need the scrolling when in landscape orientation.

Can anybody, please, give me hand to solve this issue?


I get a StackOverflowError.

If your stack trace lists a whole bunch of internal Android methods that seem to be related to drawing your UI, then your UI is too complicated. Use hierarchyviewer and your emulator to view the View/ViewGroup tree for your activity, and find ways to remove layers. For example, if your TabWidget does not hold a ViewFlipper, but rather you use an Intent to designate an activity that goes in the tab, that adds several layers to your View hierarchy more than just using Views as the contents of tabs.

My general rule of thumb is to try to keep my view hierarchies to single digit depth, as measured from the root through the longest branch. By the time you get to 15 layers, you are almost assuredly going to crash somewhere.

If your StackOverflow error does not seem to be related to drawing your UI, though, you need to post the stack trace as an edit to this question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜