web-dev-qa-db-fra.com

L'enfant à l'intérieur de NestedScrollView ne couvre pas toute la hauteur de l'écran

J'utilise NestedScrollView dans mon fragment. Dans mon xml à l'intérieur d'un RelativeLayout mais il ne couvre pas toute la hauteur de l'écran.

Voici mon code -

<?xml version="1.0" encoding="utf-8"?>
<Android.support.v4.widget.NestedScrollView xmlns:Android="http://schemas.Android.com/apk/res/Android"
Android:orientation="vertical"
Android:fitsSystemWindows="true"
Android:background="@color/black"
Android:layout_width="match_parent"
Android:layout_height="match_parent">

<RelativeLayout
    Android:background="@color/red_error_color"
    Android:layout_width="match_parent"
    Android:layout_height="match_parent">


</RelativeLayout>
</Android.support.v4.widget.NestedScrollView>

lors de l'exécution du code, seul l'arrière-plan noir est visible mais pas rouge car mon arrière-plan de vue enfant est rouge.

Merci d'avance

21
Ravi Bhandari

Essayez d'ajouter cette ligne de code sur votre nestedscrollview

Android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"

Retirer:

Android:fitsSystemWindows="true"
62
Ncit Cosmos