Skip to content

Instantly share code, notes, and snippets.

@GRizzi91
Created August 4, 2021 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GRizzi91/a2d2f5d5c27fc20d2f6d342e7574d10d to your computer and use it in GitHub Desktop.
Save GRizzi91/a2d2f5d5c27fc20d2f6d342e7574d10d to your computer and use it in GitHub Desktop.
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