diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 19ab6bd1..f85fca95 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -9,6 +9,7 @@ import androidx.viewpager2.widget.ViewPager2; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; import android.widget.Toast; import com.google.android.material.dialog.MaterialAlertDialogBuilder; @@ -130,7 +131,14 @@ public class ViewerContainerFragment extends Fragment { } // Attach tab layout to view pager - new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(viewerViewPagerAdapter.getTabTitle(position))).attach(); + new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> { + View customView = LayoutInflater.from(getContext()).inflate(R.layout.viewer_custom_tab, null); + + TextView textView = customView.findViewById(R.id.tab_title); + textView.setText(viewerViewPagerAdapter.getTabTitle(position)); + + tab.setCustomView(customView); + }).attach(); } /** diff --git a/component/viewer/src/main/res/layout/fragment_viewer_container.xml b/component/viewer/src/main/res/layout/fragment_viewer_container.xml index 2be3e503..12ed3204 100644 --- a/component/viewer/src/main/res/layout/fragment_viewer_container.xml +++ b/component/viewer/src/main/res/layout/fragment_viewer_container.xml @@ -40,7 +40,9 @@ + android:layout_height="wrap_content" + app:tabMode="scrollable" + />