Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ExpandableStackViewAdapter
class ExpandableStackViewAdapter(
private val models: List<String>,
private val context: Context
) : BaseAdapter() {
override fun getCount(): Int = models.size
override fun getItem(position: Int): String = models[position]
override fun getItemId(position: Int): Long = position.toLong()
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
val view = LayoutInflater.from(context).inflate(R.layout.card, parent, false)
view.findViewById<AppCompatTextView>(R.id.text).text = position.toString()
return view
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment