Skip to content

Instantly share code, notes, and snippets.

@john-lorrenz
Last active November 15, 2019 02:32
Show Gist options
  • Save john-lorrenz/e6a21017c91ee4d66f65c2266fd0be5e to your computer and use it in GitHub Desktop.
Save john-lorrenz/e6a21017c91ee4d66f65c2266fd0be5e to your computer and use it in GitHub Desktop.
Basic Groupie Recycler View
implementation "com.xwray:groupie:2.5.0"
implementation 'androidx.recyclerview:recyclerview:1.0.0'
override fun onCreate(savedInstanceState: Bundle?) {
reycler_view.isNestedScrollingEnabled = true
reycler_view.layoutManager = LinearLayoutManager(this)
var adapter = GroupAdapter<ViewHolder>()
adapter.add(storyItem())
adapter.add(storyItem())
adapter.add(storyItem())
adapter.add(storyItem())
reycler_view.adapter = adapter
}
inner class storyItem(): Item<ViewHolder>() {
override fun bind(viewHolder: ViewHolder, position: Int) {
}
override fun getLayout(): Int {
return R.layout.row_story
}
}
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/reycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:fadeScrollbars="false"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment