这样做可行吗?也许通过用setOnScrollChangeListener的scrollY值更新按钮的上边距?
sv.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
val buttonLayoutParams = button.getLayoutParams() as MarginLayoutParams ;
buttonLayoutParams.topMargin = scrollY ;
button.setLayoutParams(buttonLayoutParams)
}