agoda-com/Kakao

How to get item by index from some views' list in VerticalGridView?

Closed this issue · 2 comments

I have VerticalGridView that contains the list of noId ConstraintLayouts. Every ConstraintLayout is clickable but its content is not. I need to click on some constrainLayout by list index. Is it possible with Kakao methods?
image

Thanks a lot!

Hi there!
Well, your GridView is derived form RecyclerView, right?
That means, that you can use KRecyclerView to access items.
When you define an item class for KRecyclerView you have to specify constructor with argument of type Matcher. That matcher is matching to root view of the item. In that case you can use this matcher to access the root view itself:

class MyRecyclerItem(parent: Matcher<View>) : KRecyclerItem<MyRecyclerItem>(parent) {
    val root = KView { withMatcher(parent) }
}

Cheers!

Thanks a lot!