不推荐使用的TabLayout的替代方法 [英] Alternative for deprecated TabLayout

查看:203
本文介绍了不推荐使用的TabLayout的替代方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了一组常规按钮来更改属性,离散搜索条会修改其属性.触摸其中一个按钮将更改属性的值,然后该属性的设置器将更改搜索栏的最小值/最大值.此属性还用于搜索栏的 onProgressChanged 中,以确定要更改其值的属性.

I was using a set of regular buttons to change the property a discrete seek bar modifies the value of. Touching one of the buttons would change the value a property, whose setter will then change the min/max of the seekbar. This property is also used in onProgressChanged of the seek bar to determine which property to change the value of.

我想要一种指示器,这些指示器将随着这些按钮之间的动画而移动.我发现 TabLayout 提供了此功能.

I wanted some kind of indicator that would move with an animation between those buttons. I found TabLayout which provides this functionality.

唯一的问题是它是已弃用的支持库的一部分.它的参考页面指向AndroidX,在其中我无法找到有效的替代品.

The only issue is that it is a part of the deprecated Support Library. Its reference page points to AndroidX, in which I could not find a valid replacement.

TabLayout 是否有很好的替代品,还是我应该继续使用它?

Is there a good alternative to TabLayout, or should I just continue using it?

推荐答案

现在,您需要使用 com.google.android.material.tabs.TabLayout

Now you need to use com.google.android.material.tabs.TabLayout

<com.google.android.material.tabs.TabLayout
    android:id="@+id/tabLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

有关更多信息,请检查> 选项卡布局

For more information please check Tab Layout

这篇关于不推荐使用的TabLayout的替代方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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