diff --git a/app/src/main/kotlin/jackall/moncalc/adapter/CustomSpinnerAdapter.kt b/app/src/main/kotlin/jackall/moncalc/adapter/CustomSpinnerAdapter.kt new file mode 100644 index 0000000..9cc5f9a --- /dev/null +++ b/app/src/main/kotlin/jackall/moncalc/adapter/CustomSpinnerAdapter.kt @@ -0,0 +1,35 @@ +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) : 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 + } +} \ No newline at end of file