This is my Listview in Kotlin but I want to change textsize and color,
//Listview of Centers
val regioncenters = resources.getStringArray(R.array.centers_list)
var lv = findViewById<ListView>(R.id.center_content_lview)
val adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, regioncenters)
lv.adapter = adapter
so I search for this code but its suggestion that it is in Java and I want a clean Kotlin on my code
center_content_lview.setAdapter(ArrayAdapter<String>(this, R.layout.listview_text, R.id.listview_style, regioncenters))
This code is working but in the future I want my code to be Kotlin.
In kotlin You can write like this -
center_content_lview.adapter = ArrayAdapter(context, R.layout.listview_text, R.id.listview_style, regioncenters)
is this the same you are expecting?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.