简体   繁体   English

已弃用的 TabLayout 的替代方案

[英]Alternative for deprecated TabLayout

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.该属性也用于搜索栏的onProgressChanged来确定要更改哪个属性的值。

I wanted some kind of indicator that would move with an animation between those buttons.我想要某种可以在这些按钮之间随动画移动的指示器。 I found TabLayout which provides this functionality.我找到了提供此功能的TabLayout

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.它的参考页面指​​向 AndroidX,我在其中找不到有效的替代品。

Is there a good alternative to TabLayout , or should I just continue using it? TabLayout有没有好的替代TabLayout ,还是我应该继续使用它?

Now you need to use com.google.android.material.tabs.TabLayout现在你需要使用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有关更多信息,请检查Tab Layout

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM