ogaclejapan / SmartTabLayout

A custom ViewPager title strip which gives continuous feedback to the user when scrolling
Apache License 2.0
7.09k stars 1.34k forks source link

Tabs With Title and Image. #71

Closed iAviatorJose closed 8 years ago

iAviatorJose commented 9 years ago

Is there anyway to have tabs with title as well as Image ??

ogaclejapan commented 9 years ago

Hi, @iAviatorJose

Yes, you can if you use TabProvider. TabProvider can build your own layout in the tab :+1:

SmartTabLayout#setCustomTabView(TabProvider provider)

Solved?

vipulyaara commented 9 years ago

Use createTabView to use any kind of layout for your tab layout. In "smart_tab_icons_and_text", you can use text, Icons, spinner etc whatever you want.

@Override public View createTabView(ViewGroup container, int position, PagerAdapter adapter) {

            View itemView = layoutInflater.inflate(R.layout.smart_tab_icons_and_text, container, false);

            TextView text = (TextView) itemView.findViewById(R.id.custom_tab_text);
            ImageView icon = (ImageView) itemView.findViewById(R.id.custom_tab_icon);
            switch (position) {
                default:
                    throw new IllegalStateException("Invalid position: " + position);
            }

            return itemView;
        }
    });
ogaclejapan commented 8 years ago

For a long time, there is no response. So, we will close the issue.