Android的导航标签在屏幕的中间屏幕、标签、Android

2023-09-12 03:07:31 作者:仅存一点任性

在我的应用程序,我想有标签,在屏幕的中间和GMAP顶部反正​​是有在屏幕的中间位置的选项卡?

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?

下面是一个原始设计

推荐答案

您可以使用ViewPagerIndicator库(使用TabPageIndicator控制)与ViewPager控制,而这些都是从动作条完全独立的,可以放置在任何地方你喜欢。下载源代码,并检查了示例应用程序。在code是非常简单的。

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