Skip to content

Mr-XiaoLiang/LTabView

Repository files navigation

LTabView

GitHub Releases GitHub release GitHub commit activity GitHub last commit


这是一个带有动画的 TabView 项目起源于一个 Gif 图片,就是下图,出处。 出于兴趣,于是有了这个项目。 原图

成果

Tab切换效果 布局切换效果 排版切换效果

使用方法

使用方法相对简单,直接通过静态辅助类,绑定到LTabView之后,就可以直接开始addItem了,得益于Kotlin的语法,可以直接链式添加。更多使用,可以参考源码中的Demo

	val tabHelper = LTabHelper.withExpandItem(tabView)
            .addItem {
                val color = ContextCompat.getColor(this@MainActivity, R.color.purple)
                setIcon(R.drawable.ic_home_black_24dp)
                selectedIconColor = color
                unselectedIconColor = Color.BLACK
                textColor = color
                expandColor = color and 0x60FFFFFF
                text = "Home"
            }.addItem {
                val color = ContextCompat.getColor(this@MainActivity, R.color.pink)
                setIcon(R.drawable.ic_favorite_border_black_24dp)
                selectedIconColor = color
                unselectedIconColor = Color.BLACK
                textColor = color
                expandColor = color and 0x60FFFFFF
                text = "Like"
            }.addItem {
                val color = ContextCompat.getColor(this@MainActivity, R.color.orange)
                setIcon(R.drawable.ic_whatshot_black_24dp)
                selectedIconColor = color
                unselectedIconColor = Color.BLACK
                textColor = color
                expandColor = color and 0x60FFFFFF
                text = "Hot"
            }.addItem {
                val color = ContextCompat.getColor(this@MainActivity, R.color.blue)
                setIcon(R.drawable.ic_person_black_24dp)
                selectedIconColor = color
                unselectedIconColor = Color.BLACK
                textColor = color
                expandColor = color and 0x60FFFFFF
                text = "Center"
            }
        tabHelper.layoutStyle = LTabView.Style.Start
        tabHelper.onSelected {
            textView.text = "selected :$it"
        }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published