Skip to content

Instantly share code, notes, and snippets.

@TOrnelas
Created July 16, 2021 10:50
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 TOrnelas/30d52b9484ed525974ade1591f0c9075 to your computer and use it in GitHub Desktop.
Save TOrnelas/30d52b9484ed525974ade1591f0c9075 to your computer and use it in GitHub Desktop.
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val holder = ViewHolder(
LayoutInflater.from(parent.context)
.inflate(R.layout.list_item_appointment, parent, false)
)
if (!itemWidthMatchParent && items.size > 1) {
val params = holder.itemView.layoutParams
params.width =
parent.measuredWidth - (4 * parent.context.resources.getDimensionPixelSize(R.dimen.margin_10))
holder.itemView.layoutParams = params
}
return holder
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment