Cannot place button to the bottom of NestedScrollView with ConstraintLayout - android

I have the following layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/content_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/margin_32"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#id/step7_next_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.cardview.widget.CardView
android:id="#+id/online_card_cv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="#dimen/margin_16"
android:layout_marginTop="25dp"
android:background="#color/white"
app:cardCornerRadius="#dimen/margin_8">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="#dimen/margin_8">
<androidx.appcompat.widget.AppCompatRadioButton
android:id="#+id/online_card_rb"
android:layout_width="#dimen/margin_22"
android:layout_height="#dimen/margin_22"
android:layout_marginStart="#dimen/margin_16"
app:layout_constraintBottom_toBottomOf="#id/online_card_ll"
app:layout_constraintEnd_toStartOf="#id/online_card_ll"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/online_card_ll" />
<LinearLayout
android:id="#+id/online_card_ll"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/margin_16"
android:background="#color/white"
android:gravity="start"
android:orientation="vertical"
android:paddingVertical="#dimen/padding_16"
app:layout_constraintEnd_toStartOf="#id/cards_iv"
app:layout_constraintStart_toEndOf="#id/online_card_rb"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="#+id/online_card_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/online_card_title"
android:textColor="#color/new_text_color"
android:textSize="#dimen/default_text_size_14" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.4"
android:text="#string/online_card_now"
android:textColor="#color/new_text_color"
android:textSize="#dimen/default_text_size_12" />
</LinearLayout>
<ImageView
android:id="#+id/cards_iv"
android:layout_width="80dp"
android:layout_height="#dimen/margin_20"
android:layout_marginEnd="#dimen/margin_16"
android:src="#drawable/ic_visa_master"
app:layout_constraintBottom_toBottomOf="#id/online_card_ll"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/online_card_ll"
app:layout_constraintTop_toTopOf="#id/online_card_ll" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/online_card_expanded_info_cl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="#id/online_card_ll">
<View
android:id="#+id/online_card_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="#dimen/margin_16"
android:alpha="0.5"
android:background="#000001"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/cards_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/margin_32"
app:layout_constraintTop_toBottomOf="#id/online_card_divider" />
<View
android:id="#+id/cards_list_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="10dp"
android:alpha="0.5"
android:background="#000001"
app:layout_constraintTop_toBottomOf="#id/cards_list" />
<TextView
android:id="#+id/read_more_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/margin_16"
android:layout_marginTop="#dimen/margin_16"
android:layout_marginBottom="#dimen/margin_8"
android:text="#string/read_more"
android:textColor="#color/read_more_color"
android:textSize="#dimen/default_text_size_12"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/cards_list_divider" />
<LinearLayout
android:id="#+id/additional_info_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/margin_16"
android:layout_marginTop="#dimen/margin_16"
android:layout_marginBottom="#dimen/margin_8"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/cards_list_divider">
<TextView
android:id="#+id/online_card_less_info_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/online_card_less_info"
android:textColor="#color/read_more_color"
android:textSize="#dimen/default_text_size_12" />
<TextView
android:id="#+id/check_card_type_title_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_4"
android:text="#string/online_check_card"
android:textColor="#color/new_text_color"
android:textSize="#dimen/default_text_size_12"
android:textStyle="bold" />
<TextView
android:id="#+id/check_card_type_info_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/margin_8"
android:layout_marginTop="#dimen/margin_4"
android:alpha="0.75"
android:text="#string/online_check_card_info"
android:textColor="#color/new_text_color"
android:textSize="#dimen/default_text_size_12" />
<TextView
android:id="#+id/online_card_data_title_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_4"
android:text="#string/online_card_data"
android:textColor="#color/new_text_color"
android:textSize="#dimen/default_text_size_12"
android:textStyle="bold" />
<TextView
android:id="#+id/online_card_data_info_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/margin_8"
android:layout_marginTop="#dimen/margin_4"
android:alpha="0.75"
android:text="#string/online_card_data_info"
android:textColor="#color/new_text_color"
android:textSize="#dimen/default_text_size_12" />
<TextView
android:id="#+id/online_card_confirmation_title_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_4"
android:text="#string/online_card_confirmation"
android:textColor="#color/new_text_color"
android:textSize="#dimen/default_text_size_12"
android:textStyle="bold" />
<TextView
android:id="#+id/online_card_confirmation_info_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/margin_8"
android:layout_marginTop="#dimen/margin_4"
android:alpha="0.75"
android:text="#string/online_card_confirmation_info"
android:textColor="#color/new_text_color"
android:textSize="#dimen/default_text_size_12" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="#+id/bank_account_cv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="#dimen/margin_16"
android:layout_marginTop="25dp"
android:background="#color/white"
app:cardCornerRadius="#dimen/margin_8">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="#dimen/margin_8">
<androidx.appcompat.widget.AppCompatRadioButton
android:id="#+id/bank_account_rb"
android:layout_width="#dimen/margin_22"
android:layout_height="#dimen/margin_22"
android:layout_marginStart="#dimen/margin_16"
app:layout_constraintBottom_toBottomOf="#id/bank_account_tv"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/bank_account_tv" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/bank_account_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginVertical="#dimen/margin_16"
android:layout_marginStart="#dimen/margin_14"
android:text="#string/title_on_bank"
android:textAlignment="textStart"
android:textColor="#color/new_text_color"
android:textSize="#dimen/default_text_size_14"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/bank_account_rb"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/bank_account_expanded_cl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="#id/bank_account_tv">
<View
android:id="#+id/bank_account_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="#dimen/margin_16"
android:alpha="0.5"
android:background="#000001"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/iban_hint_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/margin_16"
android:layout_marginTop="15dp"
android:text="#string/step7_iban_hint"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/bank_account_divider" />
<com.google.android.material.textfield.TextInputLayout
style="#style/LoginTextInputLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="#dimen/margin_16"
android:layout_marginTop="#dimen/margin_2"
app:layout_constraintTop_toBottomOf="#id/iban_hint_tv">
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/iban_number_et"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/step7_next_btn"
android:layout_width="#dimen/width_button_next"
android:layout_height="#dimen/height_button_next"
android:layout_marginBottom="#dimen/margin_10"
android:background="#drawable/rounded_button_next"
android:text="#string/next"
android:textColor="#color/button_text_green"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
I need to tie the button to the bottom of the screen. For this purpose I added attribute app:layout_constraintBottom_toBottomOf="parent" for the button. But when I run the app my screen looks in this way:
So, why it behaves like this and what should I add to tie it to the bottom of the screen. I will appreciate any help, thanks in advance!

Add android:fillViewport="true" in NestedScrollView
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

Related

How to add a barrier in ConstraintLayout

I have a layout which I have created using RelativeLayout and LinearLayout. I am having an issue creating it back in ConstraintLayout. I have found that my problem can be solved using a barrier but I am finding it very difficult.
Expected Output :
My Output :
Here is my xml :
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/tracmor">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="#dimen/_3sdp"
app:cardBackgroundColor="#color/grey"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_5sdp"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--For Asset-->
<androidx.cardview.widget.CardView
android:id="#+id/cvAsset"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="#dimen/_10sdp"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_3sdp"
app:layout_constraintBottom_toTopOf="#+id/cvShipping"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_weight="45">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/clAsset"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/_10sdp">
<ImageView
android:id="#+id/ivAsset"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_10sdp"
android:layout_marginBottom="#dimen/_10sdp"
android:src="#drawable/assets"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tvAssetStats"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_20sdp"
android:layout_marginTop="#dimen/_10sdp"
android:layout_marginEnd="#dimen/_20sdp"
android:layout_marginBottom="#dimen/_5sdp"
android:text="#string/assetstatistics"
android:textColor="#color/black"
android:textSize="#dimen/dashboard_Title"
app:layout_constraintStart_toEndOf="#+id/ivAsset"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tvAssetNo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/_10sdp"
android:textColor="#color/blue"
android:textSize="#dimen/dashboard_Count"
app:layout_constraintEnd_toStartOf="#+id/vline"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/ivAsset"
app:layout_constraintStart_toStartOf="#id/tvAssetStats"
app:layout_constraintTop_toBottomOf="#+id/tvAssetStats" />
<TextView
android:id="#+id/tvAssetDetail"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="#dimen/_20sdp"
android:textColor="#color/blue"
android:textSize="#dimen/dashboard_Count"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/vline"
app:layout_constraintTop_toBottomOf="#+id/tvAssetStats" />
<View
android:id="#+id/vline"
android:layout_width="#dimen/_1sdp"
android:layout_height="#dimen/dashboard_Count"
android:layout_marginStart="#dimen/_5sdp"
android:layout_marginTop="#dimen/_4sdp"
android:layout_marginEnd="#dimen/_5sdp"
android:background="#color/grey2"
app:layout_constraintEnd_toStartOf="#+id/tvAssetDetail"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/tvAssetNo"
app:layout_constraintTop_toBottomOf="#+id/tvAssetStats" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<!--For Shipping-->
<androidx.cardview.widget.CardView
android:id="#+id/cvShipping"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_margin="#dimen/_10sdp"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_3sdp"
app:layout_constraintBottom_toTopOf="#+id/cvReceipt"
app:layout_constraintTop_toBottomOf="#+id/cvAsset"
app:layout_constraintVertical_weight="45">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/clShipping"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/_10sdp">
<ImageView
android:id="#+id/ivShipping"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_10sdp"
android:layout_marginBottom="#dimen/_10sdp"
android:src="#drawable/shipping"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tvShippingStats"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_20sdp"
android:layout_marginTop="#dimen/_10sdp"
android:layout_marginEnd="#dimen/_20sdp"
android:layout_marginBottom="#dimen/_5sdp"
android:text="#string/shippingactivity"
android:textColor="#color/black"
android:textSize="#dimen/dashboard_Title"
app:layout_constraintStart_toEndOf="#+id/ivShipping"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tvShippingNo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/_10sdp"
android:textColor="#color/blue"
android:textSize="#dimen/dashboard_Count"
app:layout_constraintEnd_toStartOf="#+id/vlineS"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/ivShipping"
app:layout_constraintStart_toStartOf="#id/tvShippingStats"
app:layout_constraintTop_toBottomOf="#+id/tvShippingStats" />
<TextView
android:id="#+id/tvShipppingDetail"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="#dimen/_20sdp"
android:textColor="#color/blue"
android:textSize="#dimen/dashboard_Count"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/vlineS"
app:layout_constraintTop_toBottomOf="#+id/tvShippingStats" />
<View
android:id="#+id/vlineS"
android:layout_width="#dimen/_1sdp"
android:layout_height="#dimen/dashboard_Count"
android:layout_marginStart="#dimen/_5sdp"
android:layout_marginTop="#dimen/_4sdp"
android:layout_marginEnd="#dimen/_5sdp"
android:background="#color/grey2"
app:layout_constraintEnd_toStartOf="#+id/tvShipppingDetail"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/tvShippingNo"
app:layout_constraintTop_toBottomOf="#+id/tvShippingStats" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<!--For Receipt-->
<androidx.cardview.widget.CardView
android:id="#+id/cvReceipt"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_margin="#dimen/_10sdp"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_3sdp"
app:layout_constraintBottom_toTopOf="#+id/cvkb"
app:layout_constraintTop_toBottomOf="#+id/cvShipping"
app:layout_constraintVertical_weight="45">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/clReceipt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/_10sdp">
<ImageView
android:id="#+id/ivReceipt"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_10sdp"
android:layout_marginBottom="#dimen/_10sdp"
android:src="#drawable/receiving"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tvReceiptStats"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_20sdp"
android:layout_marginTop="#dimen/_10sdp"
android:layout_marginEnd="#dimen/_20sdp"
android:layout_marginBottom="#dimen/_5sdp"
android:text="#string/receivingactivity"
android:textColor="#color/black"
android:textSize="#dimen/dashboard_Title"
app:layout_constraintStart_toEndOf="#+id/ivReceipt"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tvReceivingNo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/_10sdp"
android:textColor="#color/blue"
android:textSize="#dimen/dashboard_Count"
app:layout_constraintEnd_toStartOf="#+id/vlineR"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/ivReceipt"
app:layout_constraintStart_toStartOf="#id/tvReceiptStats"
app:layout_constraintTop_toBottomOf="#+id/tvReceiptStats" />
<TextView
android:id="#+id/tvReceivingDetail"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="#dimen/_20sdp"
android:textColor="#color/blue"
android:textSize="#dimen/dashboard_Count"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/vlineR"
app:layout_constraintTop_toBottomOf="#+id/tvReceiptStats" />
<View
android:id="#+id/vlineR"
android:layout_width="#dimen/_1sdp"
android:layout_height="#dimen/dashboard_Count"
android:layout_marginStart="#dimen/_5sdp"
android:layout_marginTop="#dimen/_4sdp"
android:layout_marginEnd="#dimen/_5sdp"
android:background="#color/grey2"
app:layout_constraintEnd_toStartOf="#+id/tvReceivingDetail"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/tvReceivingNo"
app:layout_constraintTop_toBottomOf="#+id/tvReceiptStats" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<!--For Knowledgebase-->
<androidx.cardview.widget.CardView
android:id="#+id/cvkb"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="#dimen/_10sdp"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_3sdp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/guideline"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/cvReceipt"
app:layout_constraintVertical_weight="65">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/clKb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/_10sdp">
<ImageView
android:id="#+id/ivKnowledgebase"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:src="#drawable/knowledge"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="#dimen/_10sdp"
android:gravity="center"
android:text="#string/knowledgebase"
android:textColor="#color/black"
android:textSize="#dimen/dashboard_Title"
app:layout_constraintTop_toBottomOf="#+id/ivKnowledgebase" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<!-- <View
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="#+id/cvkb"
app:layout_constraintStart_toEndOf="#+id/cvkb"
app:layout_constraintTop_toBottomOf="#+id/cvReceipt"
app:layout_constraintWidth_percent=".02" />
-->
<!--For RequestSupport-->
<androidx.cardview.widget.CardView
android:id="#+id/cvRS"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="#dimen/_10sdp"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_3sdp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#id/guideline"
app:layout_constraintTop_toBottomOf="#+id/cvReceipt"
app:layout_constraintVertical_weight="65"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/clRS"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/_10sdp">
<ImageView
android:id="#+id/ivRequestSupport"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:src="#drawable/request"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="#dimen/_10sdp"
android:gravity="center"
android:text="#string/requestsupport"
android:textColor="#color/black"
android:textSize="#dimen/dashboard_Title"
app:layout_constraintTop_toBottomOf="#+id/ivRequestSupport" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<!-- <android.support.constraint.Barrier
android:id="#+id/barrier"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:barrierDirection="end"
app:constraint_referenced_ids="cvkb,cvRS" />
-->
<androidx.constraintlayout.widget.Guideline
android:id="#+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
EveryThing is almost correct except for request support CardView
Edit : When I rotate the device the view still remains constraint but the layout is compressed and constraint layout does not show some images and text at first launch when I redirect to other fragment then it shows all images and text. landscape
firstlaunch
change your CardView which have android:id="#+id/cvRS" to be like this
<androidx.cardview.widget.CardView
android:id="#+id/cvRS"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="#dimen/_10sdp"
android:layout_marginStart="#dimen/_10sdp"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_3sdp"
app:layout_constraintBottom_toBottomOf="#id/cvkb"// this do the trick
app:layout_constraintTop_toTopOf="#id/cvkb" //
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#id/guideline"
app:layout_constraintVertical_weight="65"
>
Edit : check the full layout file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/tracmor">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="#dimen/_3sdp"
app:cardBackgroundColor="#color/grey"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_5sdp"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--For Asset-->
<androidx.cardview.widget.CardView
android:id="#+id/cvAsset"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="#dimen/_10sdp"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_3sdp"
app:layout_constraintBottom_toTopOf="#+id/cvShipping"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_weight="45">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/clAsset"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/_10sdp">
<ImageView
android:id="#+id/ivAsset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/assets"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tvAssetStats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_20sdp"
android:text="#string/assetstatistics"
android:textColor="#color/black"
android:textSize="#dimen/dashboard_Title"
app:layout_constraintBottom_toTopOf="#id/tvAssetNo"
app:layout_constraintStart_toEndOf="#+id/ivAsset"
app:layout_constraintTop_toTopOf="#id/ivAsset"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="#+id/tvAssetNo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="testValue1"
android:textColor="#color/blue"
android:textSize="#dimen/dashboard_Count"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/vline"
app:layout_constraintStart_toStartOf="#id/tvAssetStats"
app:layout_constraintTop_toBottomOf="#+id/tvAssetStats" />
<TextView
android:id="#+id/tvAssetDetail"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="testValue1"
android:textColor="#color/blue"
android:textSize="#dimen/dashboard_Count"
app:layout_constraintBottom_toBottomOf="#id/tvAssetNo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/vline"
app:layout_constraintTop_toTopOf="#+id/tvAssetNo" />
<View
android:id="#+id/vline"
android:layout_width="#dimen/_1sdp"
android:layout_height="#dimen/dashboard_Count"
android:background="#color/grey2"
app:layout_constraintBottom_toBottomOf="#id/tvAssetNo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/tvAssetNo" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<!--For Shipping-->
<androidx.cardview.widget.CardView
android:id="#+id/cvShipping"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_margin="#dimen/_10sdp"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_3sdp"
app:layout_constraintBottom_toTopOf="#+id/cvReceipt"
app:layout_constraintTop_toBottomOf="#+id/cvAsset"
app:layout_constraintVertical_weight="45">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/clShipping"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/_10sdp">
<ImageView
android:id="#+id/ivShipping"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/shipping"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tvShippingStats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_20sdp"
android:text="#string/shippingactivity"
android:textColor="#color/black"
android:textSize="#dimen/dashboard_Title"
app:layout_constraintBottom_toTopOf="#id/tvShippingNo"
app:layout_constraintStart_toEndOf="#+id/ivShipping"
app:layout_constraintTop_toTopOf="#id/ivShipping"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="#+id/tvShippingNo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/_10sdp"
android:text="testValue2"
android:textColor="#color/blue"
android:textSize="#dimen/dashboard_Count"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/vlineS"
app:layout_constraintStart_toStartOf="#id/tvShippingStats"
app:layout_constraintTop_toBottomOf="#+id/tvShippingStats" />
<TextView
android:id="#+id/tvShipppingDetail"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="testValue2"
android:textColor="#color/blue"
android:textSize="#dimen/dashboard_Count"
app:layout_constraintBottom_toBottomOf="#id/tvShippingNo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/vlineS"
app:layout_constraintTop_toTopOf="#+id/tvShippingNo" />
<View
android:id="#+id/vlineS"
android:layout_width="#dimen/_1sdp"
android:layout_height="#dimen/dashboard_Count"
android:background="#color/grey2"
app:layout_constraintBottom_toBottomOf="#id/tvShippingNo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/tvShippingNo" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<!--For Receipt-->
<androidx.cardview.widget.CardView
android:id="#+id/cvReceipt"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_margin="#dimen/_10sdp"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_3sdp"
app:layout_constraintBottom_toTopOf="#+id/cvkb"
app:layout_constraintTop_toBottomOf="#+id/cvShipping"
app:layout_constraintVertical_weight="45">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/clReceipt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/_10sdp">
<ImageView
android:id="#+id/ivReceipt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/receiving"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/tvReceiptStats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_20sdp"
android:text="#string/receivingactivity"
android:textColor="#color/black"
android:textSize="#dimen/dashboard_Title"
app:layout_constraintBottom_toTopOf="#id/tvReceivingNo"
app:layout_constraintStart_toEndOf="#+id/ivReceipt"
app:layout_constraintTop_toTopOf="#id/ivReceipt"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="#+id/tvReceivingNo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/_10sdp"
android:text="testValue3"
android:textColor="#color/blue"
android:textSize="#dimen/dashboard_Count"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/vlineR"
app:layout_constraintStart_toStartOf="#id/tvReceiptStats"
app:layout_constraintTop_toBottomOf="#+id/tvReceiptStats" />
<TextView
android:id="#+id/tvReceivingDetail"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="#dimen/_20sdp"
android:gravity="center"
android:text="testValue3"
android:textColor="#color/blue"
android:textSize="#dimen/dashboard_Count"
app:layout_constraintBottom_toBottomOf="#id/tvReceivingNo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/vlineR"
app:layout_constraintTop_toTopOf="#+id/tvReceivingNo" />
<View
android:id="#+id/vlineR"
android:layout_width="#dimen/_1sdp"
android:layout_height="#dimen/dashboard_Count"
android:background="#color/grey2"
app:layout_constraintBottom_toBottomOf="#id/tvReceivingNo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/tvReceivingNo" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<!--For Knowledgebase-->
<androidx.cardview.widget.CardView
android:id="#+id/cvkb"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="#dimen/_10sdp"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_3sdp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/cvReceipt"
app:layout_constraintVertical_weight="65">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/clKb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/_4sdp">
<ImageView
android:id="#+id/ivKnowledgebase"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/knowledge"
app:layout_constraintBottom_toTopOf="#id/tv_knowledge"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread" />
<TextView
android:id="#+id/tv_knowledge"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/knowledgebase"
android:textColor="#color/black"
android:textSize="#dimen/dashboard_Title"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/ivKnowledgebase" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<!-- <View
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="#+id/cvkb"
app:layout_constraintStart_toEndOf="#+id/cvkb"
app:layout_constraintTop_toBottomOf="#+id/cvReceipt"
app:layout_constraintWidth_percent=".02" />
-->
<!--For RequestSupport-->
<androidx.cardview.widget.CardView
android:id="#+id/cvRS"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="#dimen/_10sdp"
android:layout_marginEnd="#dimen/_10sdp"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="#dimen/_3sdp"
app:cardElevation="#dimen/_3sdp"
app:layout_constraintBottom_toBottomOf="#id/cvkb"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/guideline"
app:layout_constraintTop_toTopOf="#id/cvkb"
app:layout_constraintVertical_weight="65"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/clRS"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/_4sdp">
<ImageView
android:id="#+id/ivRequestSupport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/request"
app:layout_constraintBottom_toTopOf="#id/tv_support"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread"
/>
<TextView
android:id="#+id/tv_support"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="#dimen/dashboard_Title"
android:text="#string/requestsupport"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/ivRequestSupport" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<!-- <android.support.constraint.Barrier
android:id="#+id/barrier"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:barrierDirection="end"
app:constraint_referenced_ids="cvkb,cvRS" />
-->
<androidx.constraintlayout.widget.Guideline
android:id="#+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</ScrollView>
check this image for the final output

Android Constarint Layout ScrollView and Bottom Issue Landscape

I am using constraint layout for my page and it is working good if it in portrait but views are overlapping when it is landscape mode. I have added scroll view also , but still it is overlapping only.I need the card view should be present in the bottom and in landscape mode it should be visible while scrolling... I know the issue is because of that card view (cv_items).I don't know how to fix this issue.
Here is my xml,
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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:layout_width="match_parent"
android:fillViewport="true"
android:background="#000000"
android:layout_height="match_parent">
<ScrollView
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginBottom="0dp"
app:layout_constraintBottom_toTopOf="#+id/cv_item">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/tv_title"
style="#style/semiBoldTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="#dimen/_20sdp"
android:text="#string/you_got_req"
android:textColor="#color/light3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.cardview.widget.CardView
android:id="#+id/cv_center"
android:layout_width="#dimen/_150sdp"
android:layout_height="#dimen/_150sdp"
android:layout_gravity="center"
android:layout_marginTop="#dimen/_30sdp"
android:orientation="vertical"
app:cardBackgroundColor="#color/light3"
app:cardCornerRadius="#dimen/_150sdp"
app:cardElevation="#dimen/_10sdp"
app:contentPadding="#dimen/_2sdp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_title">
<androidx.cardview.widget.CardView
android:id="#+id/cv_accept"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="#dimen/_10sdp"
app:cardBackgroundColor="#555555"
app:cardCornerRadius="#dimen/_150sdp">
<androidx.appcompat.widget.AppCompatTextView
style="#style/semiBoldTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/accept"
android:textColor="#color/white"
android:textSize="#dimen/_15ssp" />
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<androidx.cardview.widget.CardView
android:id="#+id/cv_item"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_marginBottom="-25dp"
app:cardCornerRadius="#dimen/_15sdp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHeight_max="#dimen/_200sdp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/tv_order_number"
style="#style/semiBoldTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_20sdp"
android:layout_marginTop="#dimen/_20sdp"
android:gravity="center_vertical"
android:textColor="#color/black"
android:textSize="16sp"
tools:text="#123456789" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/tv_no_of_items"
style="#style/regularTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_order_number"
android:layout_marginStart="#dimen/_20sdp"
android:layout_marginTop="#dimen/_5sdp"
android:gravity="center_vertical"
android:textColor="#color/gray"
tools:text="6" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/tv_items"
style="#style/regularTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_order_number"
android:layout_alignBaseline="#+id/tv_no_of_items"
android:layout_marginStart="5dp"
android:layout_marginTop="#dimen/_5sdp"
android:layout_toEndOf="#+id/tv_no_of_items"
android:gravity="center_vertical"
android:text="#string/items"
android:textColor="#color/gray"
/>
<androidx.cardview.widget.CardView
android:id="#+id/cv_price"
android:layout_width="#dimen/_50sdp"
android:layout_height="#dimen/_30sdp"
android:layout_alignParentEnd="true"
android:layout_marginTop="#dimen/_10sdp"
android:layout_marginEnd="20dp"
android:gravity="center"
app:cardBackgroundColor="#color/colorPrimaryDark"
app:cardCornerRadius="#dimen/_15sdp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/tv_amount"
style="#style/semiBoldTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textColor="#color/white"
android:textSize="#dimen/_10ssp"
tools:text="1233 RS" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<View
android:id="#+id/divider1"
android:layout_width="match_parent"
android:layout_height="#dimen/dp_half"
android:layout_below="#id/tv_items"
android:layout_margin="#dimen/_10sdp"
android:background="#color/light4" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_items"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/divider1"
android:layout_marginStart="#dimen/_10sdp"
android:layout_marginEnd="#dimen/_10sdp"
android:layout_marginBottom="#dimen/_20sdp"
tools:itemCount="20"
tools:listitem="#layout/recycler_test_details" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
Please refer the screenshots.
Try to put everything inside ScrollView. Check below:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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:background="#000000"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="#+id/cv_item">
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/tv_title"
style="#style/semiBoldTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="#dimen/_20sdp"
android:text="#string/you_got_req"
android:textColor="#color/light3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.cardview.widget.CardView
android:id="#+id/cv_center"
android:layout_width="#dimen/_150sdp"
android:layout_height="#dimen/_150sdp"
android:layout_gravity="center"
android:layout_marginTop="#dimen/_30sdp"
android:orientation="vertical"
app:cardBackgroundColor="#color/light3"
app:cardCornerRadius="#dimen/_150sdp"
app:cardElevation="#dimen/_10sdp"
app:contentPadding="#dimen/_2sdp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv_title">
<androidx.cardview.widget.CardView
android:id="#+id/cv_accept"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="#dimen/_10sdp"
app:cardBackgroundColor="#555555"
app:cardCornerRadius="#dimen/_150sdp">
<androidx.appcompat.widget.AppCompatTextView
style="#style/semiBoldTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/accept"
android:textColor="#color/white"
android:textSize="#dimen/_15ssp" />
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.cardview.widget.CardView
android:id="#+id/cv_item"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_marginBottom="-25dp"
app:cardCornerRadius="#dimen/_15sdp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHeight_max="#dimen/_200sdp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/tv_order_number"
style="#style/semiBoldTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_20sdp"
android:layout_marginTop="#dimen/_20sdp"
android:gravity="center_vertical"
android:textColor="#color/black"
android:textSize="16sp"
tools:text="#123456789" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/tv_no_of_items"
style="#style/regularTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_order_number"
android:layout_marginStart="#dimen/_20sdp"
android:layout_marginTop="#dimen/_5sdp"
android:gravity="center_vertical"
android:textColor="#color/gray"
tools:text="6" />
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/tv_items"
style="#style/regularTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_order_number"
android:layout_alignBaseline="#+id/tv_no_of_items"
android:layout_marginStart="5dp"
android:layout_marginTop="#dimen/_5sdp"
android:layout_toEndOf="#+id/tv_no_of_items"
android:gravity="center_vertical"
android:text="#string/items"
android:textColor="#color/gray"
/>
<androidx.cardview.widget.CardView
android:id="#+id/cv_price"
android:layout_width="#dimen/_50sdp"
android:layout_height="#dimen/_30sdp"
android:layout_alignParentEnd="true"
android:layout_marginTop="#dimen/_10sdp"
android:layout_marginEnd="20dp"
android:gravity="center"
app:cardBackgroundColor="#color/colorPrimaryDark"
app:cardCornerRadius="#dimen/_15sdp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<androidx.appcompat.widget.AppCompatTextView
android:id="#+id/tv_amount"
style="#style/semiBoldTextInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textColor="#color/white"
android:textSize="#dimen/_10ssp"
tools:text="1233 RS" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<View
android:id="#+id/divider1"
android:layout_width="match_parent"
android:layout_height="#dimen/dp_half"
android:layout_below="#id/tv_items"
android:layout_margin="#dimen/_10sdp"
android:background="#color/light4" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_items"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/divider1"
android:layout_marginStart="#dimen/_10sdp"
android:layout_marginEnd="#dimen/_10sdp"
android:layout_marginBottom="#dimen/_20sdp"
tools:itemCount="20"
tools:listitem="#layout/recycler_test_details" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

ConstrainLayout Not scrolling inside NestedScrollview

I am trying to make my layout scrollable with constrainlayout but it's not scrolling at all i also tried with scrollview and nestedscrollview also tried by making constrain root layout but still not getting scrollable layout. Here is my XML layout. Can you please tell me what i am doing wrong here
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:colorBackground"
android:clickable="true"
android:fillViewport="true"
android:focusable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/coverProfileImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:colorBackground">
<ImageView
android:id="#+id/coverPhoto"
android:layout_width="match_parent"
android:layout_height="500dp"
android:src="#color/custom_transparent_colorBlack"
android:scaleType="centerCrop"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="#tools:sample/backgrounds/scenic" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profilePic"
android:layout_width="128dp"
android:layout_height="128dp"
app:layout_constraintBottom_toBottomOf="#+id/coverPhoto"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/coverPhoto"
app:layout_constraintVertical_bias="0.44"
tools:srcCompat="#tools:sample/avatars" />
<ImageButton
android:id="#+id/addFriendButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/round_shape_only"
android:padding="10dp"
app:layout_constraintBottom_toBottomOf="#+id/profilePic"
app:layout_constraintEnd_toStartOf="#+id/profilePic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/profilePic"
app:srcCompat="#drawable/ic_add_friend" />
<ImageButton
android:id="#+id/messageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/round_shape_only"
android:padding="10dp"
app:layout_constraintBottom_toBottomOf="#+id/profilePic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/profilePic"
app:layout_constraintTop_toTopOf="#+id/profilePic"
app:srcCompat="#drawable/ic_message" />
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="#+id/coverPhoto"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/profilePic"
app:layout_constraintVertical_bias="0.100000024" />
<TextView
android:id="#+id/cityCountry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="#+id/coverPhoto"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/name"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="#+id/followerCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="410dp"
android:text="TextView"
app:layout_constraintEnd_toStartOf="#+id/followingCount"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/coverPhoto"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/followingCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="#+id/followerCount"
app:layout_constraintEnd_toStartOf="#+id/friendsCount"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/followerCount"
app:layout_constraintTop_toTopOf="#+id/followerCount" />
<TextView
android:id="#+id/friendsCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="#+id/followingCount"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/followingCount"
app:layout_constraintTop_toTopOf="#+id/followingCount" />
<TextView
android:id="#+id/followersTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="460dp"
android:text="TextView"
app:layout_constraintEnd_toEndOf="#+id/followerCount"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="#+id/followerCount"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/followingTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintBaseline_toBaselineOf="#+id/followersTag"
app:layout_constraintEnd_toEndOf="#+id/followingCount"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="#+id/followingCount" />
<TextView
android:id="#+id/friendsTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintBaseline_toBaselineOf="#+id/followingTag"
app:layout_constraintEnd_toEndOf="#+id/friendsCount"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="#+id/friendsCount" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.core.widget.NestedScrollView
android:id="#+id/up_NestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="5dp"
android:paddingRight="5dp"
>
<com.google.android.material.tabs.TabLayout
android:id="#+id/tabItemes"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Monday" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tuesday" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Wednesday" />
</com.google.android.material.tabs.TabLayout>
<androidx.viewpager.widget.ViewPager
android:id="#+id/profileViewPager"
android:layout_below="#id/tabItemes"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
Add a CoordinatorLayout at the top of the nestedScrollView and set app:layout_behavior="#string/appbar_scrolling_view_behavior" for NestedScrollView
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="true"
android:measureAllChildren="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:background="#color/colorPrimary">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/home_constraint"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
you need to add
android:isScrollContainer="true"
In your nestedScrollView

Page Scroll Problems with CardView and ListView

I have a XML layout as follows:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/accounts_details_page_background_color">
<android.support.v7.widget.CardView
android:id="#+id/overview_cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:background="#color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
card_view:cardElevation="2dp"
card_view:ignore="PrivateResource">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp">
<TextView
android:id="#+id/fragment_compliance_details_overview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="#string/compliance_details_fragment_overview"
android:textColor="#color/compliance_overview_title_color"
android:textSize="#dimen/text_size_small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/policy_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:textColor="#color/black"
android:textSize="#dimen/text_size_large"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/fragment_compliance_details_overview" />
<TextView
android:id="#+id/last_check_time_only"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/text_size_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/policy_name" />
<View
android:id="#+id/horizontal_line_compliance"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="16dp"
android:background="?android:attr/listDivider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/last_check_time_only" />
<TextView
android:id="#+id/compliance_policy_status_explanation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textSize="#dimen/text_size_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/horizontal_line_compliance" />
<TextView
android:id="#+id/last_check_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="#string/last_compliance_check_time"
android:textSize="#dimen/text_size_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/compliance_policy_status_explanation" />
<TextView
android:id="#+id/compliance_user_action_advice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="#string/compliance_user_advice"
android:textSize="#dimen/text_size_small"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/last_check_time" />
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/details_cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="#color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/overview_cardview"
app:layout_constraintVertical_bias="0.0"
card_view:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:orientation="vertical">
<TextView
android:id="#+id/policy_details_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="#string/policy_details_title"
android:textColor="#color/compliance_overview_title_color"
android:textSize="14sp"
android:textStyle="bold"
android:visibility="gone" />
<ListView
android:id="#+id/compliance_rules_listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:visibility="gone" />
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.constraint.ConstraintLayout>
When the ListView has more than 3-4 rows the page does not scroll. The ListView does not scroll either.
I tried wrapping the whole thing in a NestedScrollView but that just gets the ListView scrolling and not even entirely.
I want the entire page to scroll and end scrolling when the ListView ends. Any ideas would help.
You don't need constraint layout for what you are doing.
Read about view weights.
Try this. (replace androix.* for your components)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:id="#+id/overview_cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:background="#color/white"
app:cardUseCompatPadding="true"
app:contentPadding="4dp"
card_view:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/fragment_compliance_details_overview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/policy_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test"
android:textColor="#color/black"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/fragment_compliance_details_overview" />
<TextView
android:id="#+id/last_check_time_only"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/policy_name" />
<View
android:id="#+id/horizontal_line_compliance"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="16dp"
android:background="?android:attr/listDivider" />
<TextView
android:id="#+id/compliance_policy_status_explanation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="test"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/horizontal_line_compliance" />
<TextView
android:id="#+id/last_check_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="test"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/compliance_policy_status_explanation" />
<TextView
android:id="#+id/compliance_user_action_advice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="#string/has_accepted_your_invitation_to_fynd"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/last_check_time" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="#+id/details_cardview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#color/white"
app:cardUseCompatPadding="true"
app:contentPadding="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/overview_cardview"
app:layout_constraintVertical_bias="0.0"
card_view:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/policy_details_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="test"
android:textSize="14sp"
android:textStyle="bold" />
<ListView
android:id="#+id/compliance_rules_listview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>

NestedScrollView dosent scroll all the way to the end of Fragment

I have an Activity open multiple Fragments using using ViewPager and TabLayout. When I try to implement scroll for the fragment using NestedScrollView, I am not able to scroll all the way to the end of the fragment. Is there something missing or incorrect with this layout?
Activity Layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.design.widget.AppBarLayout
android:id="#+id/detail_app_bar"
android:layout_width="match_parent"
android:layout_height="240dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/detail_collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="#color/colorPrimary"
app:expandedTitleMargin="#dimen/horizontal_margin"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.facebook.drawee.view.SimpleDraweeView
android:id="#+id/detail_photo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:actualImageScaleType="focusCrop"
app:layout_collapseMode="parallax"
app:placeholderImageScaleType="centerInside"
app:viewAspectRatio="1.33"
fresco:placeholderImage="#drawable/empty_detail" />
<android.support.v7.widget.Toolbar
android:id="#+id/detail_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:contentInsetStart="#dimen/horizontal_margin"
app:layout_collapseMode="pin"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/detail_viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.design.widget.TabLayout
android:id="#+id/detail_tab_layout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabSelectedTextColor="#color/colorAccent"
app:tabTextColor="#color/tertiaryText" />
</android.support.v4.view.ViewPager>
</android.support.design.widget.CoordinatorLayout>
Fragment Layout:
<android.support.v4.widget.NestedScrollView 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:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:background="#color/White"
android:clipToPadding="false"
android:padding="16dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context=".UI.Details.DetailsActivity">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.constraint.Guideline
android:id="#+id/guideline"
android:layout_width="8dp"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />
<TextView
android:id="#+id/current_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="TextView"
android:textSize="45sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/weather_condition_image"
android:layout_width="140dp"
android:layout_height="144dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:src="#drawable/ic_thunderstrom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/current_temp" />
<TextView
android:id="#+id/weather_condition_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:text="TextView"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/weather_condition_image" />
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="48dp"
android:layout_marginStart="48dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#+id/linearLayout3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/weather_condition_text">
<TextView
android:id="#+id/sunrise"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/sunrise" />
<TextView
android:id="#+id/sunrise_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5:00am"
android:textColor="#color/Black"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#+id/linearLayout4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.300"
app:layout_constraintStart_toStartOf="#+id/guideline"
app:layout_constraintTop_toBottomOf="#+id/weather_condition_text">
<TextView
android:id="#+id/sunset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/sunset" />
<TextView
android:id="#+id/sunset_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6:00pm"
android:textColor="#color/Black"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="48dp"
android:layout_marginStart="48dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#+id/linearLayout5"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/linearLayout1">
<TextView
android:id="#+id/humidity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/humidity" />
<TextView
android:id="#+id/humidity_percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="83%"
android:textColor="#color/Black"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="#+id/linearLayout6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.300"
app:layout_constraintStart_toStartOf="#+id/guideline"
app:layout_constraintTop_toBottomOf="#+id/linearLayout2">
<TextView
android:id="#+id/wind"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/wind" />
<TextView
android:id="#+id/wind_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5.1mph"
android:textColor="#color/Black"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="48dp"
android:layout_marginStart="48dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/linearLayout3">
<TextView
android:id="#+id/min_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/temp_min" />
<TextView
android:id="#+id/min_temp_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="72"
android:textColor="#color/Black"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.340"
app:layout_constraintStart_toStartOf="#+id/guideline"
app:layout_constraintTop_toBottomOf="#+id/linearLayout4">
<TextView
android:id="#+id/max_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/temp_max" />
<TextView
android:id="#+id/max_temp_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="80"
android:textColor="#color/Black"
android:textSize="20sp" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>

Categories

Resources