I have an android layout_file that looks something like the following
I ran into the same problem. To solve, I used padding instead of margin and then I set android:fillViewport="true" for ScrollView. Anything goes well now!
padding
margin
android:fillViewport="true"