• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

neokree/MaterialTabs: Custom Tabs with Material Design effects

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

neokree/MaterialTabs

开源软件地址(OpenSource Url):

https://github.com/neokree/MaterialTabs

开源编程语言(OpenSource Language):

Java 100.0%

开源软件介绍(OpenSource Introduction):

MaterialTabs

Custom Tabs with Material Design animations for pre-Lollipop devices
Android Arsenal     Donate

Download example apk

It requires 14+ API and android support v7 (Toolbar)

IMPORTANT NOTICE

This library is no longer supported.
I have not enough time to continue developing at this time and the android design support library implements the tabs features in the better way, so I think it is useless now. If anyone wants to keep alive this library they can send pull requests AFTER testing the code and exmplaining what they have changed and why. Thanks to all contributors

Dependency: Android-UI Reveal Color View
If you are using MaterialTabs in your app and would like to be listed here, please let me know via email!

How to use:

define it in xml layout with custom attributes ```xml ``` ( I'm working on use wrap_content instead 48dp)

Connect to java code and add to viewPager

MaterialTabHost tabHost;

@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		tabHost = (MaterialTabHost) this.findViewById(R.id.materialTabHost);
		pager = (ViewPager) this.findViewById(R.id.viewpager);
		
		// init view pager
		pagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
		pager.setAdapter(pagerAdapter);
		pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
            @Override
            public void onPageSelected(int position) {
            	// when user do a swipe the selected tab change
                tabHost.setSelectedNavigationItem(position);
            }
        });
		
		// insert all tabs from pagerAdapter data
		for (int i = 0; i < pagerAdapter.getCount(); i++) {
            tabHost.addTab(
                    tabHost.newTab() 
                            .setIcon(getIcon(i))
                            .setTabListener(this)
                            );
    }
}

@Override
	public void onTabSelected(MaterialTab tab) {
		// when the tab is clicked the pager swipe content to the tab position
		pager.setCurrentItem(tab.getPosition());
		
	}

N.B. Your activity must extends ActionBarActivity implements MaterialTabListener

How to import

Android Studio

Add this to your build.gradle:

dependencies {
    compile 'it.neokree:MaterialTabs:0.11'
}

Limitations

Actually, this library have some limitations: - No selector animations

These problems are currently in development

Fixed and Scrollable tabs.

With text tabs

[1 - 3] Fixed Tabs
[4 - ∞] Scrollable Tabs

With icon tabs

[1 - 5] Fixed Tabs
[6 - ∞] Scrollable Tabs

screenshot

screenshot

screenshot

screenshot




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap