I have an app in the market right now that uses a custom designed tab
bar at the bottom of the screen and a relative layout at the top that
acts as an iframe, so this is very doable.  In my app I used the
LocalActivityManager to load the requested activity and then extract
it's main layout, like this:

[code]

LocalActivityManager manager = getLocalActivityManager();

Intent preloader = new Intent("com.pkg.Foo");
View childView = manager.startActivity(preloader.getAction(),
preloader.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();

frame.removeAllViews();
frame.addView(childView);

[/code]

Each of the buttons in the tab bar calls to a loading function with
the requested Activity name and options like ViewFlipper index or
other startup options.  After you add the childView to the frame, you
can also do something like this to animate in the view.

[code]

childView.startAnimation(slideLeftAnimation);

[/code]

The only problem with this approach is that LocalActivityManager has
been deprecated as if this month in favor of Fragments and the
FragmentManager.  So you might want to look into both options and see
what works best for your users and app needs.  If you look at the
demos over at android.com there is a tab example using Fragments.


On Aug 25, 1:40 am, Damien Cooke <cooke.dam...@gmail.com> wrote:
> Hi all,
> I am sure what I want to do is possible I think I am going about it the wrong 
> way.
>
> I am building a kind-of tab controller.  I am attempting to define compound 
> views in XML layouts and I want to import them into my Activity.  The idea 
> being that each "tab" continues to function regardless whether it is visible 
> or not.  
>
> What I am attempting to do is create a View object and inflate the layout I 
> want into the View Object.  Is this the correct approach?  (by the way the 
> reason I can not use the tabhost is because the client needs a scrolling 
> tabbar so they can have 10 options on the tab bar, so I have implemented a 
> scrollview containing buttons for the tabbar)
>
> The structure will be an array of Views each attached to one of the buttons 
> in the scrollView.  When selected the View object (if not already populated) 
> will populate using inflate then become visible.
>
> Am I close? Is this the wrong approach? Thanks in advance for any assistance.
>
> Regards
> Damien

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to