Android NestedScrollView fillViewport stretching incorrectly
Solution 1
I have used it like this:
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
...
Maybe the difference is that the linear layout has a specified orientation or maybe I am using a more updated library com.android.support:design:23.1.0
and that is the reason why I cant reproduce your problem.
Solution 2
Maybe I am too late for this, but the way I solved this was to replace NestedScrollView
child (in your case, RelativeLayout
) margin
with padding
. If that didn't work, also try replacing RelativeLayout
child margin
with padding
.
Let me know if that works!
Joe
Updated on June 20, 2022Comments
-
Joe almost 2 years
I am trying to use the new
NestedScrollView
from the support libraries. I want the scrollable content to expand to match parent if it is smaller. I see that to do that, I'm supposed to addfillViewport=true
to theNestedScrollView
. When I do this, my scrollable content doesn't stretch vertically, it instead stretches horizontally off-screen.The layout card_movie simply has a
RelativeLayout
with some TextViews and oneImageView
inside it. Nothing special. -
worked over 8 yearsBoom! That's what I'm talking about!