27 lines
952 B
Kotlin
27 lines
952 B
Kotlin
|
|
package com.example.accountbook.adapter
|
||
|
|
|
||
|
|
import android.content.Context
|
||
|
|
import android.view.LayoutInflater
|
||
|
|
import android.view.View
|
||
|
|
import android.view.ViewGroup
|
||
|
|
import android.widget.ArrayAdapter
|
||
|
|
import com.example.accountbook.R
|
||
|
|
import com.example.accountbook.databinding.ItemTableBinding
|
||
|
|
|
||
|
|
class AdapterTable(context: Context, private val data: Array<String>):
|
||
|
|
ArrayAdapter<String>(context, R.layout.item_table, data) {
|
||
|
|
private lateinit var bind:ItemTableBinding
|
||
|
|
|
||
|
|
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
||
|
|
var rView: View? = convertView
|
||
|
|
if (rView == null) {
|
||
|
|
// 최초 생성
|
||
|
|
bind = ItemTableBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||
|
|
}
|
||
|
|
bind.textDate.text = "10/25"
|
||
|
|
bind.textAmount.text = "10,000"
|
||
|
|
bind.textMemo.text = "커피"
|
||
|
|
bind.textCategory.text = "기타"
|
||
|
|
return bind.root
|
||
|
|
}
|
||
|
|
}
|