Viewpager在与Android的底部固定卡口与图标和文本的每个选项卡 [英] Viewpager in Android with fixed tabs at bottom with Icon and Text in each tab

查看:298
本文介绍了Viewpager在与Android的底部固定卡口与图标和文本的每个选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建以下布局 - 用与保持该活动的底部,表明该4个片段,用户是在(与选定的选项卡被通过主动强调了标签沿viewpager活动颜色')

I want to create the following layout - an activity with a viewpager along with a tab that stays that the bottom of the activity to indicate which of the 4 fragments the user is in (and the selected tab gets highlighted by an 'active colour')

我花了一些时间看网上添加此标签的各种资源。

I've spent some time looking at various resources online to add this tab.

http://developer.android.com/training/implementing-导航/ lateral.html#标签 - 这看起来像它会工作得很好,直到我发现了 actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 是德precated

http://developer.android.com/training/implementing-navigation/lateral.html#tabs - this looked like it would work well until I found out that actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); is deprecated

我看了然而,它是相同的溶液(即去precated)

I looked here however, it is the same solution (i.e. deprecated)

我看了<一个href=\"http://stackoverflow.com/questions/24473213/action-bar-navigation-modes-are-de$p$pcated-in-android-l\">here然而,PagerTitleStrip显示一个选项卡(和部分邻近的标签),而我希望看到所有选项卡(有没有部分隐藏的选项卡中的图片)

I looked here however, the PagerTitleStrip shows one tab (and partly the adjacent tabs) while I want to see all the tabs (there are no partially hidden tabs as in the picture)

有没有说明如何实现这一目标的教程?这是最基本的UI元素之一,所以我希望我没有找到最佳的解决方案。

Is there a tutorial that explains how to achieve this? It is one of the most basic UI elements, so I am hoping I am not finding the best solution

推荐答案

我一直在寻找同样的,我看到的这个问题
在这里这个答案 OP说,

I was looking for same and I saw this question, here in this answer OP says that

这是对Android的设计导则,因为在底部有像后退按钮home键软/硬按钮等。

it's against Android Design Guideline since at bottom there are soft/hard buttons like back button home button etc.

http://developer.android.com/design/patterns/pure- android.html

但如果你坚持把它们放在底部,你可以像GitHub的例子包括在底部的标签,使用FragmentTabHost实现它。

But if you insist on to put them at the bottom, you can implement it like GitHub example consists tabs in bottom, using FragmentTabHost.

https://github.com/rameshkec85/BottomTabsFragmentTabHost

所以,即使我正在考虑它。

So even I am considering it.

这篇关于Viewpager在与Android的底部固定卡口与图标和文本的每个选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆