I need to set programatically the height of a button as matchparent in my constraintLayout class.
open class Myword @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
) : ConstraintLayout(context,attrs) {
var set = ConstraintSet()
val tastoetim= Button(this.context)
init{
this.addView(tastoetim)
tastoetim.requestLayout()
set.connect(tastoetim.id, ConstraintSet.LEFT,this.id, ConstraintSet.LEFT, 10)
set.connect(tastoetim.id, ConstraintSet.BOTTOM,this.id, ConstraintSet.BOTTOM, 0)
tastoetim.minHeight = 0
tastoetim.getLayoutParams().height= ViewGroup.LayoutParams.MATCH_PARENT
} }
this does not work.
As already pointed out by author of this post (set height of imageview as matchparent programmatically), none of these answers works.