Monday, May 2, 2011

[android-developers] Tabs inside a fragment

Having read the post here: http://goo.gl/6xYBD (Android 3.0-Tabhost)
and based on the lack of a TabFragment it appears that the way to do
things in 3.0 (and I guess above) is to use tabs in the action bar.

My issue is that I'm writing an app that has the fairly standard
'listview on left, content on right' layout, and I'd like my content
on the right to have tabs. I know I can change the right fragment
using the tabs in the action bar, but from a UI perspective, it just
looks wrong. The tabs in the action bar look like they preside over
the *whole* application as they are above the left ListView as well.
For example, in the HoneycombGallery app, the Android/Balloons/
Bikes.... tabs change both the ListView fragment and the content
fragment. Mine would only change which aspect of the content you're
looking at.

I tried inflating a TabHost into the fragment but I get
NullPointerExceptions when I run TabSpec.setContent (that may be me
doing something wrong - I'll have another run at debugging it but
figured I'd ask this anyway).

I hope that all makes sense. If I need to explain better please let
me know. I'm very interested in how others are solving this problem
since I think the 'listview | content' style is quite common. At the
moment, my alternatives are either to fake tabs with buttons
(something I'd rather avoid) or to present menu buttons in the action
bar to change what you're looking at.

Thank you,

Stephen

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment