I\'m using the new class provided by the design library : TabLayout. And I want in specific cases that the one I\'m using can\'t change tab anymore.
I manage to disa
For me the working approach is this:
bool condition = ...
foreach (var view in _tabLayout.Touchables)
view.Clickable = condition;
This is 100% safe, as getTouchables() call is supported since API 1. No need to manually traverse layout or something. I consider it to be much simpler than that of the accepted answer, but only when all the tabs have to be marked not clickable.
P.S.: example is on C#, as I am working with Xamarin, but it is fairly easy to translate it back to Java. Enjoy! =)
Kotlin example:
tabLayout.touchables.forEach { it.isClickable = false }
Java example:
for (View v: tabLayout.getTouchables())
v.setClickable(false);