这是一个带有动画的 TabView 项目起源于一个 Gif 图片,就是下图,出处。 出于兴趣,于是有了这个项目。
使用方法相对简单,直接通过静态辅助类,绑定到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"
}