Android Tutorial TabStripViewPager - Better ViewPager

Not open for further replies.

This library is based on the following open source project:

It is an alternative to StdViewPager. It is simpler to use and looks better.
It is implemented as a custom view. It requires B4A v5.8+.

It is very simple to add a TabStrip to your app.

Add the TabStrip with the visual designer and configure it:


Note the usage of anchors to fill the available space.

Create a layout file for each page. Again use anchors to fill the available space:


Load the main layout and then add pages with a call to TabStrip.LoadLayout:
Sub Activity_Create(FirstTime As Boolean)
   TabStrip1.LoadLayout("Page1", "PAGE 1")
   TabStrip1.LoadLayout("Page2", "THIS IS PAGE 2")
   TabStrip1.LoadLayout("Page3", "AND PAGE 3")
End Sub

Add the following text to the manifest editor (it creates the short press effect):
'********* TabStrip ***********************
CreateResource(drawable, background_tab.xml,
<selector xmlns:android=""
  <item android:state_pressed="true" android:drawable="@color/background_tab_pressed" />
  <item android:state_focused="true" android:drawable="@color/background_tab_pressed"/>
  <item android:drawable="@android:color/transparent"/>
CreateResource(values, colors.xml,
  <color name="background_tab_pressed">#6633B5E5</color>

If you are using B4A v6+ then you should add this line:

As Android support library requires Android 4+ (API level 14+), TabStripViewPager also requires Android 4+.


    10.9 KB · Views: 2,458
    30.5 KB · Views: 1,646
Last edited:


Licensed User
This is the scenario ,
I think 20 tabs , each tab and read a LoadLayout with UltimateListView , then go around TabStrip ( r.Target = jo.GetField ( " TabStrip " ) ) to find all UltimatListView , and is only 11 .

Without doing the same operation with 10 , is all right .


Active Member
Licensed User
Thanks Erel! Maybe I'm a little dumb but I can't seem to figure out how to use the code. I tried
but it's crashing for me. Could you please show me the right way to use it?


New Member
Licensed User
The TabStrip example looks beautiful on my old Nexus7 (running android 4.4.4).

But then when I try to run on a test phone (android 5.0.2) it goes a bit sideways.
The Tabstip example compiles fine.
The phone prompts "Install"
I let the system decide the preferred install location
But just get a message "X App not installed"

I am running:
B4A v5.8
B4A-Bridge v2.14

I tried removing and reinstalling the B4Bridge with no joy.

I got this mesage in the log:
Installing file.
** Activity (main) Resume **
Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value.
Timeline: Activity_idle id: android.os.BinderProxy@8f2973 time:1389080

I must be doing something (basic) wrong; has anyone got any suggestions.



Licensed User
Is there a way to hide the Tabstrip altogether? I am using it like the Contacts app, so it represents a filtered view, but I have multiple areas and one of them cannot be filtered so I'd like to hide it when that area is selected.


Licensed User
Can you post a screenshot of the layout that you are trying to implement?

My app has a TabStrip at the top, under the toolbar, and a BottomNavigation at the bottom. The 5 items in the BottomNavigation represent the entities in my app. By tapping on an item, the user can choose which entity they are viewing in the UltimateListView in the middle. The 4 tabs in the TabStrip at the top represent the available filters within each area, e.g. "All", "Approved", "Completed", etc.

These TabStrip tab titles change as the user selects each entity from the BottomNavigation. That works. But the first "entity" at the very left of the BottomNavigation isn't actually an entity. It's a Dashboard view which summarises all entities. So when this item is selected in the BottomNavigation, I want to hide the TabStrip as there are no filters available in this view.



Licensed User
You can put a Panel over the TabStrip (with the designer) and play with its visibility.

Thanks Erel. I have a panel underneath the TabStrip already to get the background color (a tip I read in this thread) as I wasn't able to get the background color to work via the manifest settings or control properties. If I put a panel over the TabStrip I may be able to hide the TabStrip but the users will just see a gap between the Toolbar and the ListView which will look really odd.

Is there perhaps a way to set the TabStrip tab height to 0 and disable the scrolling?


Licensed User
There should be no gap. The panel will completely hide the TabStrip.

Yes, sorry, by "gap" I meant that there will be either a white or blue rectangle between the ToolBar at the top of the Layout and the ListView that fills the layout where the TabStrip was, and my Dashboard (just custom UltimateListView cells) will start partway down the screen. It would be nicer visually if the space occupied by the TabStrip could be consumed by the UltimateListView when on the Dashboard view.


Licensed User
The tool bar at the top is part of TabStrip view. The panel will hide it completely.
I don't want to hide the ToolBar. That contains my app title and search menu, etc. I only want to hide the TabStrip which is a view below the ToolBar.


Licensed User
Thank you Erel! Your solution seems so obvious and yet I couldn't see it. I was trying to cover just the TabStrip and not the whole layout. :oops:
Not open for further replies.