在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):neokree/MaterialTabs开源软件地址(OpenSource Url):https://github.com/neokree/MaterialTabs开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):MaterialTabsCustom Tabs with Material Design animations for pre-Lollipop devices It requires 14+ API and android support v7 (Toolbar) IMPORTANT NOTICEThis library is no longer supported. Dependency: Android-UI Reveal Color View define it in xml layout with custom attributes ```xml ``` ( I'm working on use wrap_content instead 48dp) How to use: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 How to importAndroid StudioAdd this to your build.gradle: dependencies {
compile 'it.neokree:MaterialTabs:0.11'
} Actually, this library have some limitations: - No selector animations LimitationsThese problems are currently in development Fixed and Scrollable tabs.With text tabs[1 - 3] Fixed Tabs With icon tabs[1 - 5] Fixed Tabs |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论