Newer
Older
MonCalc / app / src / main / kotlin / jackall / moncalc / adapter / CustomSpinnerAdapter.kt
package jackall.moncalc.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import jackall.moncalc.R
import kotlinx.android.synthetic.main.custom_spinner_item.view.*


/**
 * Created by matsumoto_k on 2017/11/03.
 */
class CustomSpinnerAdapter(context: Context, val items: List<String>) : BaseAdapter() {
    val inflater: LayoutInflater = LayoutInflater.from(context)

    override fun getView(position: Int, view: View?, viewGroup: ViewGroup?): View {
        val view = inflater.inflate(R.layout.custom_spinner_item, null)
        view.custom_spinner_item_text.text = items.get(position)
        return view
    }

    override fun getItem(p0: Int): Any? {
        return null
    }

    override fun getItemId(p0: Int): Long {
        return 0
    }

    override fun getCount(): Int {
        return items.size
    }
}