TabLayout与pagerTabStrip的便捷性和功能性 [英] TabLayout versus pagerTabStrip for convenience and functionality

查看:148
本文介绍了TabLayout与pagerTabStrip的便捷性和功能性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用ViewPager时,使用TabLayout代替PagerTabStrip有什么好处,反之亦然?还是等价的?一个比另一个更方便吗?一个提供更大的功能吗?在ViewPager的上下文中,再次提出了所有问题,因此也期望得到所有答案.谢谢.

When using a ViewPager, is there any advantage to using TabLayout instead of PagerTabStrip or vice versa? Or are they equivalent? Is one more convenient than the other? Does one offer greater functionality? Again all questions are asked, and thus all answers are expected, in the context of ViewPager. Thanks.

推荐答案

TabLayout是一个实质性概念,它取代了Android 5.0中不推荐使用的ActionBar选项卡. 它扩展了Horizo​​ntalScrollView,因此您可以继续水平添加选项卡,其中可以包含文本,图标或自定义视图,并且可以线性滚动它们而无需分页.

TabLayout is a material concept that replaced the deprecated ActionBar tabs in Android 5.0. It extends HorizontalScrollView, so you can keep adding tabs horizontally which can include text, icons, or custom views and scroll through them linearly without paging.

TabLayout提供了setupWithViewPager(ViewPager viewPager)方法来附加到ViewPager,而不是像PagerTabStrip一样是ViewPager的一部分.

TabLayout provides the setupWithViewPager(ViewPager viewPager) method to attach to a ViewPager instead of being part of the ViewPager like the PagerTabStrip.

PagerTabStrip更像是ViewPager当前页面的指示符,并且它旨在用作ViewPager小部件的子视图".它的滚动不像TabLayout那样工作,因为每个选项卡都是页面的一部分,而不是可以单独水平滚动的页面.

A PagerTabStrip is more of an indictor for the current page of a ViewPager, and "it is intended to be used as a child view of a ViewPager widget". The scrolling for it does not act like the TabLayout since each tab is part of the page instead of individually horizontally scrollable.

这篇关于TabLayout与pagerTabStrip的便捷性和功能性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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