0

I use Tablayout and create tabs dynamically. Then the app selects a proper tab by code:

myTablayout.getTabAt(int_position).select();

But I have a problem: selected tab doesn't display on the screen (if he isn't one of first) and I need to scroll for his reaching.

enter image description here

What can I do that a selected tab display in a center of the screen? (exclude tabs which on edges, of course, but they just must display on the screen exactly)

I don't use Viewpager. It does not need for my task.

XML myTablout:

<android.support.design.widget.TabLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/quick_tournament2"
    android:layout_alignParentBottom="true">
</android.support.design.widget.TabLayout>
Yevgen
  • 93
  • 1
  • 1
  • 8

0 Answers0