ogaclejapan / SmartTabLayout

A custom ViewPager title strip which gives continuous feedback to the user when scrolling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I set up icons instead of letters?

NoAH10833 opened this issue · comments

public View onCreateView(@nonnull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {

    View root = inflater.inflate(R.layout.fragment_gallery, container, false);

    galleryViewModel =
            new ViewModelProvider(this).get(GalleryViewModel.class);

    binding = FragmentGalleryBinding.inflate(inflater, container, false);


    smartTabLayout = root.findViewById(R.id.viewpagertab);
    viewPager = root.findViewById(R.id.viewpager);
    tabStrip = root.findViewById(R.id.tab_icon);




    //adaptar abas
    FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
            getActivity().getSupportFragmentManager(),
            FragmentPagerItems.with(getActivity())
                    .add("TUDO", TodosFragment.class)
                    .add("cima", TopFragment.class)
                    .add("selva", JGFragment.class)
                    .add("meio", MidFragment.class)
                    .add("baixo", ADCFragment.class)
                    .add("baixo1", SUPFragment.class)
                    .create()


    );
    viewPager.setAdapter( adapter );
    smartTabLayout.setViewPager( viewPager );



    return root;
}
@Override
public void onDestroyView() {
    super.onDestroyView();
    binding = null;
}

}

that's my code, I'm using it to display the tabs over another fragment, it's functional, but I don't know how to replace the letters with image icons