Created
February 2, 2018 13:13
-
-
Save t-kashima/efa3831aa35daa589745ec5f50975965 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.unuuu.bookkeeper.view.adapter | |
... | |
class ExampleAdapter(context: Context) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { | |
... | |
private val inflater: LayoutInflater = LayoutInflater.from(context) | |
private class CommentViewHolder(view: View) : RecyclerView.ViewHolder(view) { | |
fun initialize(comment: Comment) { | |
comment.subComment.forEach { | |
// viewをLayoutInflatorを使ってxmlから生成する | |
val subView = inflater.inflate(R.layout.adapter_example_row_sub_comment, viewGroup, false) | |
subView.initialize(it) | |
view.comemntLayout.addView(subView) | |
} | |
... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment