I was having the same problem discussed over here Align Button to Bottom in ScrollView but with native Android.
Imagine you have following layout:
As the content might not fit on smaller screens/configurations you wrap your content in a scrollview. Plus: To avoid that users miss critical content which is below the fold you want that the CTA is positioned below the content.
But now the CTA is not aligned to the bottom of the screen anymore. For taller devices where no scrolling is necessary it would look like this:
How can we get the button still be positioned on the bottom when the content is not scrolling?
It is pretty simple to achieve that:
Make your ScrollView
grow the whole screen by using android:fillViewport="true"
This will stretch the child (ConstraintLayout) to fill the whole screen if it is smaller.
Now that the child of the scrollview is full-height, you can align the CTA to the bottom of it's parent
And if the content scrolls, the button will still align below it.