我怎样才能让水平标签导航(刷卡视图)与操作栏导航选项卡?视图、选项卡、水平、标签

由网友(握不住的沙不如扬了它)分享简介:如何才能让水平标签导航(刷卡意见),如果我用行动起来吧导航标签的? How can I allow horizontal tab navigation (swipe views) if I'm using action bar navigation tabs?有什么特别的我必须做的就是这个与 ActionBarShe...

如何才能让水平标签导航(刷卡意见),如果我用行动起来吧导航标签的?

How can I allow horizontal tab navigation (swipe views) if I'm using action bar navigation tabs?

有什么特别的我必须做的就是这个与 ActionBarSherlock ?

Is there anything special I have to do to get this to work with ActionBarSherlock?

推荐答案

在code生成的东西了(在Eclipse中的新的活动的向导从BlankActivity)一个标签+刷卡活动有$ C $下本。基本上,你的标签绑定到一个 ViewPager ,要求 setCurrentItem()更改页面,而不是运行自己的 FragmentTransaction 或以其他方式影响用户界面。该 ViewPager 处理水平刷卡,你填充使用某种形式的 PagerAdapter 这些页面(一个是code为您生成)。请参阅this非常相关的问题和答案了解。

The code-generated stuff for a "Tabs+Swipe" activity (from BlankActivity in the new activity wizard in Eclipse) has code for this. Basically, your tabs tie into a ViewPager, calling setCurrentItem() to change the page, rather than running their own FragmentTransaction or otherwise affecting the UI. The ViewPager handles the horizontal swiping, and you populate those pages using some form of PagerAdapter (one is code generated for you). See this very related question and answer for more.

有什么特别的我必须做的就是这个与ActionBarSherlock工作?

Is there anything special I have to do to get this to work with ActionBarSherlock?

除了标准的东西用ActionBarSherlock,应要求没有什么不寻常的。 ViewPager 是在Android支持包,ActionBarSherlock也需要,所以你将有一个已经在你的项目中。

Other than standard stuff for using ActionBarSherlock, nothing out of the ordinary should be required. ViewPager is in the Android Support package, which ActionBarSherlock also needs, so you will have that already in your project.

请注意,虽然,行动起来吧标签只是有时显示为标签。在一些屏幕尺寸和方向,它们会自动转换成一个下拉列表(列表导航的操作栏,而不是标签导航)。如果您想使用标签,所有的时间,而不是使用操作栏选项卡与 ViewPager ,使用 PagerTabStrip (从Android的支持包),或者从一个合适的指标 ViewPagerIndicator 代替。

Note, though, that action bar tabs only sometimes show up as tabs. In some screen sizes and orientations, they are automatically converted into a drop-down list (per "list navigation" with the action bar instead of "tab navigation"). If you want to use tabs all of the time, rather than using action bar tabs with ViewPager, use PagerTabStrip (from the Android Support package) or a suitable indicator from ViewPagerIndicator instead.

阅读全文

相关推荐

最新文章