Android Question Adding TabStrip

JamesGreaves

Active Member
Licensed User
Please be patient with me here, I am missing something fundamental.
I simply want to add TabStrip to my app.

I have read: "It is very simple to add a TabStrip to your app. Add the TabStrip with the visual designer and configure it:"

But how??
 

LucaMs

Expert
Licensed User
Longtime User
That phrase does not mean: "Add N TabStrip" by Designer but add the TabStripViewPager by Designer.

As you can see in the example, adding TabStrips is done by code:

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
TabStrip1.LoadLayout(
"Page1", "PAGE 1")
TabStrip1.LoadLayout(
"Page2", "THIS IS PAGE 2")
TabStrip1.LoadLayout(
"Page3", "AND PAGE 3")
End Sub

LoadLayout creates the TabStrip page.
 
Last edited:
Upvote 0

JamesGreaves

Active Member
Licensed User
OK, I got it to work.
For the sake of those who may ask the same question this is what I did:

1. I added the library "TabStripViewPager" library by checking the checkbox in the Libraries Manager.
(I am not sure if "TabStripViewPager" was in the library list before as I did not notice. If not, I cannot say for sure how it got there)

2. Then I went to the Designer and added the TabStrip. (Add View > CustomView > TabStrip)

3. I then added the Dim to the code from within the Designer. (Right-click TabStrip1 > Generate > "Dim TabStrip1 as TabStrip")

4. Then I added the line: #AdditionalJar: com.android.support:support-v4
to the code.

It's working now.
 
Upvote 0

JamesGreaves

Active Member
Licensed User
OH! i discovered. To add the "TabStripViewPager" to the Libraries Manager you have to do the following:

1. Download the "TabStripViewPager" library at https://www.b4x.com/android/forum/attachments/tabstripviewpager_library-zip.54915/

2. Extract the files and copy them (TabStripViewPager.jar and TabStripViewPager.xml) into your LIBRARY folder (whereever that is on your PC)

Sorry this is SO step-by-step but that's sometimes what I sometimes need to get things done.
 
Upvote 0
Top