android, kotlin, ArrayAdapter example« Wróć do listy pytań

list
Wysłane przez mrmucha
Zadane przez 05/02/2020 09:15
0
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        var array = arrayOf("Melbourne", "Vienna", "Vancouver", "Toronto", "Calgary", "Adelaide", "Perth", "Auckland", "Helsinki", "Hamburg", "Munich", "New York", "Sydney", "Paris", "Cape Town", "Barcelona", "London", "Bangkok")

        val myAdapter = ArrayAdapter(context!!, android.R.layout.simple_list_item_single_choice, array)
        lista.adapter = myAdapter
        lista.onItemClickListener = AdapterView.OnItemClickListener { _, view, _, _ ->
            view.isSelected = true
        }
    }
Wysłane przez mrmucha
Odpowiedziane 05/02/2020 09:15