When I use layout_height="wrap-content"
in the CorrdinatorLayout
, there is a margin at the bottom. Here's my code:
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_details_coordinator_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:background="@color/ui_view_primary_background"
android:orientation="vertical">
<include layout="@layout/activity_item_details_appbar_v2"/>
<androidx.core.widget.NestedScrollView
android:id="@+id/scrollview_transaction_details_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_marginBottom="?attr/actionBarSize"
android:background="?attr/ui_v2_color_neutral_100">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/transaction_summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
When i change CoordinatorLayout
height to match_parent
, it works fine. But, i want to have keep it as wrap_content
. I have seen many answers that says add android:fitsSystemWindows="true"
to the coordinatorlayout. But, for me, its not working. Any idea why is this happening like this?
This is the screenshot of my screen. Black area is the
AppBarLayout
and area marked in red is the unwanted margin. Any idea on how to fix this? Thanks