Android Question tabstripviewpager add layouts programatically

apty

Active Member
Licensed User
Longtime User
I am creating panels programmatically like below:
B4X:
for i=0 to 9
dim pnl as Panel
pnl.initialize("")
next
How can i add these panels to tabstripviewpager so that i swipe through all (10) of them?
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

apty

Active Member
Licensed User
Longtime User
The panels are generated in code and are to be added to the tabstripviewpager.
B4X:
TabStrip1.LoadLayout("Page1", "PAGE 1")
requires a layout created in designer, if i am not wrong. My layouts are panels created in code
 
Upvote 0

apty

Active Member
Licensed User
Longtime User
If i use the panel as layout, the app crashes with an exception that file is not found, because it is looking for layout file.

B4X:
For i=0 To 10
        Dim pnlx As Panel
        pnlx.Initialize("")
        pnlx.Color=Colors.red
        TabStrip1.LoadLayout(pnlx,"") 'this causes the app to crash as it expects a layout file
    Next
 
Upvote 0

apty

Active Member
Licensed User
Longtime User
ok thanks.Seems its hard with tabstrip.

The idea is for the panels to each hold several buttons and then scroll through these panels horizontally. All these is done in code without layout file. For now i can use scrollview though in this case the scrolling is vertical
 
Upvote 0
Top