tags:

views:

48

answers:

2

Hallo,

Any idea where I can find a simple tabs example?

The Android Developers Hello Views Tab Layout example only details how to use separate Activities for each Tab.

I would like to use tabs to extend a screen of settings without scrolling, i.e. there are too many options for a single screen, so I'd like to split them over two tabs, but still handle them in the same Activity.

Each tab can refer to a separate layout file if that is how it needs to be done,

TIA,

-Frink

+1  A: 

In your tabhost instead of passing an intent you can pass a viewID

Falmarri
@FrinkTheBrave: Here is a sample project demonstrating this technique: http://github.com/commonsguy/cw-android/tree/master/Fancy/Tab/
CommonsWare
Just what I was looking for, thanks.Is there any way of defining the contents of the tabs in separate xml files (so I can use Layout View in Eclipse to help during design?)I'll try it myself tomorrow, but I need to go to bed :-(
FrinkTheBrave
You might be able to setContent(R.layout.main1), setContent(R.layout.main2), etc. But I've never used this way before
Falmarri
Just found out, I can use include statements in my xml to include views in other xml files!
FrinkTheBrave
+1  A: 

if your tabs don't need to be dynamic you can just load the views in the xml file. Just like in this example http://developer.android.com/guide/tutorials/views/hello-tabwidget.html

schwiz