I have a floating action button that I would like to add on top of a scrollview so that the button stays, even if you scroll. I want it on the top of the scrollview and in t
Later children in a RelativeLayout tend to float over earlier children in a RelativeLayout.
(I say "tend to" because Android 5.0's elevation stuff also plays a role, and the relationship between them is ill-defined)
So, to have a floating action button (FAB) float over a ScrollView in a RelativeLayout, make sure that the ScrollView is defined first in the XML, with the FAB after it. This will not affect the X/Y rules, but it should have the FAB appear over the ScrollView on the Z axis.
Another possibility, if you are only supporting Android 5.0+, would be to use android:elevation itself to raise the FAB.