Reputation: 3
I dont understand this. I cant setText() on view created using inflater.inflate()
val justView = inflater.inflate(R.layout.mybutton, null, false)
ayatList.addView(justView)
justView.setText("OK")
Upvotes: 0
Views: 52
Reputation: 20137
You need to cast the result to TextView
(assuming that that layout is just a TextView
—note that Button
is a type of TextView
):
val justView = inflater.inflate(R.layout.mybutton, null, false) as TextView
ayatList.addView(justView)
justView.setText("OK")
Upvotes: 2