title: TabLayout setupWithViewPager bug
body: <p>I have an example activity on which I'm adding 50 Fragments to a ViewPager. When I tap on a tab (from TabLayout), this one becomes underlined. It's the default behaviour.
  <a href="https://i.stack.imgur.com/CUdyn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CUdyn.png" alt="enter image description here"></a></p>
  
  <p>Inside the Fragment, I have a button, Close, which calls mAdapter.remove(position); and here comes the problem, because I'm getting:
  <a href="https://i.stack.imgur.com/YkQmJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YkQmJ.png" alt="enter image description here"></a></p>
  
  <p>So, the current Fragment, is 46, which is right, but even if I set up with setupWithViewPager() - and so there is a listener which should automatically do it - after closing test45, the tab test46 is not shown automatically with its underline. Why? To me it seems related to something inside calculateScrollXForTab(...) at line 418 in TabLayout.java, but maybe I'm simply wrong.</p>
  
  <p>I made a public repository with this example, so you can try it on-the-fly: <a href="https://github.com/MyWay/TabLayoutBug" rel="nofollow noreferrer">https://github.com/MyWay/TabLayoutBug</a></p>