LinearLayout not expanding inside a ScrollView

Solution 1:

Found the solution myself in the end. The problem was not with the LinearLayout, but with the ScrollView (seems weird, considering the fact that the ScrollView was expanding, while the LinearLayout wasn't).

The solution was to use android:fillViewport="true" on the ScrollView.

Solution 2:

I know this post is very old, For those who don't want to use android:fillViewport="true" because it sometimes doesn't bring up the edittext above keyboard. Use Relative layout instead of LinearLayout it solves the purpose.

Solution 3:

Can you provide your layout xml? Doing so would allow people to recreate the issue with minimal effort.

You might have to set

android:layout_weight="1"

for the item that you want expanded