debug
06/28/2016, 7:52 AMval tabs =
tabLayout {
id = R.id.tabs
setupWithViewPager(pager)
for (i in 0 until tabCount) {
val tab = getTabAt(i)
tab?.customView = imageView {
id = android.R.id.icon
}.lparams(dip(64), dip(64))
tab?.setIcon(R.drawable.ic_filter)
}
tabMode = TabLayout.MODE_SCROLLABLE
backgroundColor = Color.WHITE
}.lparams(matchParent, matchParent) {
above(R.id.pager)
}
It throws "Caused by: java.lang.IllegalArgumentException: Only TabItem instances can be added to TabLayout". Meaning that it thinks that the imageView
is being added to TabLayout
, can this be avoided and just create simple View
with the DSL?
Here, I'm only trying to create an imageView
and set it to tab?.customView
.
Open to any alternate solutions.