4

In my app i want to have tabs in the middle of the screen and a gMap at the top is there anyway to position the tabs in the middle of the screen?

Here is a raw design

a busy cat
(source: qnex.me)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
nairdat
  • 179
  • 1
  • 3
  • 10
  • Related, without using library: http://stackoverflow.com/questions/31417209/android-tabs-in-middle-of-layout/36796343#36796343 – RominaV Apr 22 '16 at 14:23
  • @RominaV Your solution shows the tab, but the Fragment contents shows up empty and the swipe actions does not work. – James Poulose Apr 10 '21 at 04:00

1 Answers1

3

You can use ViewPagerIndicator library (using TabPageIndicator control) with a ViewPager control, and these are completely separate from the ActionBar and can be positioned anywhere you like. Download the source and check out the sample app. The code is very straightforward.

Here's an example straight from the source of the sample app

https://github.com/JakeWharton/Android-ViewPagerIndicator/blob/master/sample/res/layout/simple_tabs.xml

Rich
  • 36,270
  • 31
  • 115
  • 154