android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams
动态设置FrameLayout的属性时报错,上级元素是LinearLayout
private fun setFrameLayoutStyle(frameLayout: FrameLayout, top: Number) { val frameParams = frameLayout.layoutParams as LinearLayout.LayoutParams frameParams.topMargin = top as Int frameLayout.layoutParams = frameParams }
Android动态设置组件属性