当前位置:网站首页>mTabLayout.setOnTabSelectedListener is deprecated
mTabLayout.setOnTabSelectedListener is deprecated
2022-06-10 11:34:00 【yechaoa】
用addOnTabSelectedListener代替,方法一样。
源码:
/**
* @deprecated Use {@link #addOnTabSelectedListener(OnTabSelectedListener)} and
* {@link #removeOnTabSelectedListener(OnTabSelectedListener)}.
*/
@Deprecated
public void setOnTabSelectedListener(@Nullable OnTabSelectedListener listener) {
// The logic in this method emulates what we had before support for multiple
// registered listeners.
if (mSelectedListener != null) {
removeOnTabSelectedListener(mSelectedListener);
}
// Update the deprecated field so that we can remove the passed listener the next
// time we're called
mSelectedListener = listener;
if (listener != null) {
addOnTabSelectedListener(listener);
}
}
/**
* Add a {@link TabLayout.OnTabSelectedListener} that will be invoked when tab selection
* changes.
*
* <p>Components that add a listener should take care to remove it when finished via
* {@link #removeOnTabSelectedListener(OnTabSelectedListener)}.</p>
*
* @param listener listener to add
*/
public void addOnTabSelectedListener(@NonNull OnTabSelectedListener listener) {
if (!mSelectedListeners.contains(listener)) {
mSelectedListeners.add(listener);
}
}边栏推荐
- 线性代数的本质4 矩阵乘法与线性复合变换
- 【 ten thousand people single wooden bridge 】 how to arrange life in that summer after the college entrance examination?
- Carbon reduction in the construction industry is by no means a fresh idea experts suggest strengthening the transformation of rural buildings
- "Forget to learn again" shell Basics - 29. Awk built-in variables
- After an error occurs in the source observable, it will be directly entered into the catchrror operator instead of the sequence in the pipe before entering the catchrror
- [how much do you know about management] apart from independent conflict, you can't do it
- 动态规划(mid)
- 线性代数的本质6 逆矩阵、列空间与零空间
- Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
- What is the difference between NoClassDefFoundError and classnotfoundexception
猜你喜欢

How can the team be dissolved...

SaaS management system for digital commerce cloud business service industry: to achieve efficient business collaboration and help enterprises improve their digital transformation

2022年Z-Wave生态系统状态报告

Transfomer自实现与官方库

Long term learning of graphic and text pre training.

Source of concurrent bugs (I) - visibility

Peking University and Microsoft | progress in reasoning to make language models better

从 0 开始构建研发高效能全栈式团队

Testing ovn manually based on LXD (by quqi99)

Detailed explanation of redis
随机推荐
Peking University and Microsoft | progress in reasoning to make language models better
十三、系统调用和Shell(freestanding shell, 终端和 job control)
Pytorch tensor高阶操作
Fun face recognition software
二叉树的前序中序后序递归遍历和非递归遍历(c语言版本)
[Huang ah code] how to ensure that the images uploaded by PHP are safe?
Practice of Flink CDC + Hudi massive data entering the lake in SF
计网面试题
大型项目综合实训
【Question】what‘s the scenario of aliasing a class interface
牛客面经02
Day 1 stack and queue (simple)
Long term learning of graphic and text pre training.
“易 +”开源计划丨基于 WebRTC 的低延时播放器设计和实践
Transfomer各组件与Pytorch
[signalr complete series] Implementation of signalr packet communication in net6
纪念正月十六工作室总访问量突破百万
爱可可AI前沿推介(6.10)
基于Junit4的单元测试
【Question】rxjs/operator takeWhile vs takeUntil