Skip to content

Instantly share code, notes, and snippets.

@samyak-jain
Last active November 24, 2020 09:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save samyak-jain/1023a4a0d3a8bc200de92eb7fcf4fce5 to your computer and use it in GitHub Desktop.
// We are using GridLayoutManager to arrange the items of the RecyclerView in a grid pattern
// We are setting span count as 2, so that are grid has 2 rows
// We are setting the orientation of the layout as horizontal
val remoteViewManager = GridLayoutManager(this, 2, GridLayoutManager.HORIZONTAL, false)
// We are using our custom adapter here
remoteViewAdapter = RemoteViewAdapter(uidList, mRtcEngine)
// We are now referencing the RecyclerView in our XML and then setting the relevant parameters
// We are setting hasFixedSize as true since the measurement of the individual items will not dynamically change
findViewById<RecyclerView>(R.id.remote_container).apply {
layoutManager = remoteViewManager
adapter = remoteViewAdapter
setHasFixedSize(true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment