Layout params type is determined by the parent type. You get the layout params from one view mT1layoutScore
and then try to set up them in another mT2layout
the parent of which is of a different type.
Set the layout params on the same object, or since you're editing the layout params in-place, just call mT1layoutScore.requestLayout()
.