Android Question Tabstrip viewpager - howto remove Tabstrip?

bjf

Member
Licensed User
Longtime User
Hello.
Anybody know how to remove a tabstrip when it's located in the same layout as the panel(s) it is called from?
I populate it with 3 tabs in a search function.
Then if i go back to do another search it will populate the same tabstrip with 3 ADDITIONAL tabs, not new ones.
This is off course logical since the tabstrip is never removed after the first call.

In the tutorial (https://www.b4x.com/android/forum/threads/tabstripviewpager-better-viewpager.63975/) the tabstrip is located in a separate layout but that does not work for me due to problems displaying labels and text when i return from the separate layout.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
We cannot do anything to help you with:
"the tabstrip is located in a separate layout but that does not work for me due to problems displaying labels and text when i return from the separate layout."
Or:
"Yeah, tried that but does not work"

Why didn't it work? Can you upload a small project that demonstrates the problem?
 
Upvote 0

bjf

Member
Licensed User
Longtime User
Sample project in link:
http://flodin.ax/b4a/TabStripTest.zip

The tabstrip will load with the 3 tabs when clicking the button.
Then if you go back via back-button and load agin it will create 3 new tabs even though
the parent panel was removed first.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Move TabStrip1 to its own layout file.
Remove Tabpanel from the main layout file.

B4X:
Sub Button1_Click
   Tabpanel.RemoveView
   Activity.AddView(Tabpanel,0,0,100%x,100%y)
   TabPanel1.LoadLayout("LayoutWithTabStrip")  
   TabStrip1.LoadLayout("Tab1", "Tab 1")
   TabStrip1.LoadLayout("Tab2", "Tab 2")
   TabStrip1.LoadLayout("Tab3", "Tab 3")
End Sub
 
Upvote 0

bjf

Member
Licensed User
Longtime User
Thanks for your response.
That's what i tried first, but it resulted in another problem:
I call the tabstrip from a Panel with labels wich is populated with data from a sql server query.
When i return from the tabstrip layout to the original panel all the labels are empty.
Does that seem logical at all or am i doing something wrong with the loading of different layouts to get that kind of behaviour?
 
Upvote 0
Top