-2

I want to create a TabActivity that works like a browser. When the activity is created, it has two tabs: "Tab1" and "Add Tab". When the "Add Tab" is clicked, it should Add a new tab.

Tab 1 | Add Tab
==> Add Tab is clicked
Tab 1 | Tab 2 | Add Tab
==> Add Tab is clicked
Tab 1 | Tab 2 | Tab 3 | Add Tab

I don't know how to do. I try few days. but still failed.

THelper
  • 15,333
  • 6
  • 64
  • 104

1 Answers1

0

You can't use Tab Activity for this purpose, because Tab Activity can't defined at run time.

You can use other views like Relative Layout, Liner Layout etc. for fulfill your requirement. You have to arrange all the layout like that user experience like they use Tab Activity.

For example:-

for top bar from where user can add new tab, you can use Liner Layout and add dynamically new tab's icon as per requirement.

Same thing you can do for other things.

Mohit Kanada
  • 15,274
  • 8
  • 31
  • 41