I am using this code in kotlin to update the layout_weight of a linear_layout as an indication. When the button is pressed though, the layout weight doesn't change.
This will eventually be a fun app using random updates but for now I want to make sure that the code works. predWt is the button id physWt is the linearlayout id (currently set with weight 0.3)
predWt.setOnClickListener {
physWt.layoutParams.apply {
(this as LinearLayout.LayoutParams).weight = 0.85f }
}
The app launches OK and when the button is pressed the layout_weight of the linearlayout should update to 0.85f from 0.3 but does not. There are no error messages generated.