I have already searched SO and none of the answer helped me.
Here is my layout xml:
<android.support.v7.widget.CardView
android:id="@+id/layout_building"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_8dp"
app:layout_constraintEnd_toStartOf="@+id/scrollview_nested_fragment_container"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/views_container">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/layout_building_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
</ScrollView>
</android.support.v7.widget.CardView>
I'm adding child views to my LinearLayout
dynamically via code. I have also tried to move the ScrollView
tag to wrap CardView
but still no luck. Is this a limitation of CardView
or do any one know a working solution to this.
Okay first of all thanks to every one for helping with your valauble suggestions. The actual problems lies with the ConstraintLayout
. All needs to be done is add a constraint app:layout_constraintBottom_toBottomOf="parent"
to the cardview and set android:layout_height="0dp"
. The cardview didn't have any boundary inforced. Unlike LinearLayout and RelativeLayout which by default inforce the boundary to their child views.