Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem in using NestedScrollView in Constraint layout

I am using Constraint layout inside the NestestScrollView as shown below.

<?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:id="@+id/clProfileFragment"
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.appcompat.widget.AppCompatImageView
    android:id="@+id/appCompatImageView8"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:scaleType="centerCrop"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHeight_percent="0.7"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@mipmap/bg_nature" />


<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/ivProfileFragment"
    android:layout_width="30dp"
    android:layout_height="30dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="16dp"
    android:src="@drawable/ic_profile"
    android:visibility="visible"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<TextView
    android:id="@+id/tvUserName"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="16dp"
    android:fontFamily="@font/raleway_medium"
    android:letterSpacing="0.2"
    android:textAlignment="center"
    android:textColor="@color/darkBlue"
    app:layout_constraintBottom_toBottomOf="@+id/ivProfileFragment"
    app:layout_constraintStart_toEndOf="@+id/ivProfileFragment"
    app:layout_constraintTop_toTopOf="@+id/ivProfileFragment"
    tools:text="Mehul Kanzriya" />


<androidx.appcompat.widget.AppCompatImageView
    android:id="@+id/ivCloseProfileFragment"
    style="@style/VectorImageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="start"
    android:layout_marginTop="16dp"
    android:layout_marginEnd="16dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@drawable/ic_close" />

<androidx.core.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:fillViewport="true"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/ivProfileFragment"
    app:layout_constraintBottom_toTopOf="@id/button">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center">

        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginTop="32dp"
            android:layout_marginEnd="8dp"
            android:fontFamily="@font/raleway_semibold"
            android:letterSpacing="0.3"
            android:text="@string/text_subscribe"
            android:textColor="@color/darkBlue"
            android:textSize="18sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="16dp"
            android:letterSpacing="0.3"
            android:text="@string/text_subscription_feature_1"
            android:textAlignment="center"
            android:textColor="@color/subscriptionFeaturesColor"
            android:textSize="@dimen/subscriptionFeaturesSize"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/textView" />

        <TextView
            android:id="@+id/textView4"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:letterSpacing="0.3"
            android:text="@string/text_subscription_feature_2"
            android:textAlignment="center"
            android:textColor="@color/subscriptionFeaturesColor"
            android:textSize="@dimen/subscriptionFeaturesSize"
            app:layout_constraintEnd_toEndOf="@+id/textView2"
            app:layout_constraintStart_toStartOf="@+id/textView2"
            app:layout_constraintTop_toBottomOf="@+id/textView2" />

        <TextView
            android:id="@+id/textView5"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:letterSpacing="0.3"
            android:text="@string/text_subscription_feature_3"
            android:textAlignment="center"
            android:textColor="@color/subscriptionFeaturesColor"
            android:textSize="@dimen/subscriptionFeaturesSize"
            app:layout_constraintEnd_toEndOf="@+id/textView4"
            app:layout_constraintStart_toStartOf="@+id/textView4"
            app:layout_constraintTop_toBottomOf="@+id/textView4" />

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/appCompatImageView2"
            android:layout_width="350dp"
            android:layout_height="168dp"
            android:layout_marginTop="32dp"
            app:layout_constraintEnd_toEndOf="@+id/textView5"
            app:layout_constraintStart_toStartOf="@+id/textView5"
            app:layout_constraintTop_toBottomOf="@+id/textView5"
            app:srcCompat="@mipmap/bg_pdf_resting" />

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/cvAnnualPlan"
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            app:cardBackgroundColor="@android:color/transparent"
            app:cardCornerRadius="14dp"
            app:cardElevation="0dp"
            app:layout_constraintEnd_toStartOf="@+id/cvMonthlyPlan"
            app:layout_constraintHorizontal_chainStyle="spread"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/appCompatImageView2"
            app:strokeColor="@color/darkBlue"
            app:strokeWidth="3dp">

            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="2dp"
                app:cardBackgroundColor="@color/subscriptionCardBackgroundColor"
                app:cardCornerRadius="12dp"
                app:cardElevation="0dp">

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">


                    <TextView
                        android:id="@+id/textView7"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:background="@color/darkBlue"
                        android:fontFamily="@font/raleway_medium"
                        android:letterSpacing="0.1"
                        android:padding="8dp"
                        android:text="@string/text_subscription_most_popular"
                        android:textAlignment="center"
                        android:textColor="@android:color/white"
                        android:textSize="12sp"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <TextView
                        android:id="@+id/textView3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="8dp"
                        android:layout_marginTop="32dp"
                        android:layout_marginEnd="8dp"
                        android:fontFamily="@font/raleway_semibold"
                        android:letterSpacing="0.3"
                        android:text="ANNUAL"
                        android:textColor="@color/lightYellow"
                        android:textSize="@dimen/subscriptionPlanTitle"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@+id/textView7" />

                    <TextView
                        android:id="@+id/textView6"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="8dp"
                        android:layout_marginTop="16dp"
                        android:layout_marginEnd="8dp"
                        android:fontFamily="@font/roboto_bold"
                        android:text="Rs 60.00"
                        android:textColor="@android:color/white"
                        android:textSize="@dimen/subscriptionPlanPrice"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@+id/textView3" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="8dp"
                        android:layout_marginTop="8dp"
                        android:layout_marginEnd="8dp"
                        android:layout_marginBottom="32dp"
                        android:fontFamily="@font/raleway_semibold"
                        android:letterSpacing="0.3"
                        android:text="@string/text_per_month"
                        android:textColor="@android:color/white"
                        android:textSize="@dimen/subscriptionPlanMonthly"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@+id/textView6" />

                </androidx.constraintlayout.widget.ConstraintLayout>

            </com.google.android.material.card.MaterialCardView>
        </com.google.android.material.card.MaterialCardView>

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/cvMonthlyPlan"
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            app:cardBackgroundColor="@android:color/transparent"
            app:cardCornerRadius="14dp"
            app:cardElevation="0dp"
            app:layout_constraintBottom_toBottomOf="@+id/cvAnnualPlan"
            app:layout_constraintEnd_toEndOf="parent"

            app:layout_constraintStart_toEndOf="@+id/cvAnnualPlan"
            app:layout_constraintTop_toTopOf="@+id/cvAnnualPlan"
            app:strokeColor="@color/darkBlue"
            app:strokeWidth="3dp">

            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="2dp"
                app:cardBackgroundColor="@color/subscriptionCardBackgroundColor"
                app:cardCornerRadius="12dp"
                app:cardElevation="0dp">

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">


                    <TextView
                        android:id="@+id/textView8"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:padding="8dp"
                        android:textSize="12sp"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <TextView
                        android:id="@+id/textView44"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="8dp"
                        android:layout_marginTop="32dp"
                        android:layout_marginEnd="8dp"
                        android:fontFamily="@font/raleway_semibold"
                        android:letterSpacing="0.3"
                        android:text="MONTHLY"
                        android:textColor="@color/lightYellow"
                        android:textSize="@dimen/subscriptionPlanTitle"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@+id/textView8" />

                    <TextView
                        android:id="@+id/textView66"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="8dp"
                        android:layout_marginTop="16dp"
                        android:layout_marginEnd="8dp"
                        android:fontFamily="@font/roboto_bold"
                        android:text="Rs 70.00"
                        android:textColor="@android:color/white"
                        android:textSize="@dimen/subscriptionPlanPrice"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@+id/textView44" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="8dp"
                        android:layout_marginTop="8dp"
                        android:layout_marginEnd="8dp"
                        android:layout_marginBottom="32dp"
                        android:fontFamily="@font/raleway_semibold"
                        android:letterSpacing="0.3"
                        android:text="@string/text_per_month"
                        android:textColor="@android:color/white"
                        android:textSize="@dimen/subscriptionPlanMonthly"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@+id/textView66" />

                </androidx.constraintlayout.widget.ConstraintLayout>

            </com.google.android.material.card.MaterialCardView>
        </com.google.android.material.card.MaterialCardView>

        <TextView
            android:id="@+id/textView9"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="8dp"
            android:letterSpacing="0.3"
            android:text="@string/text_subscription_feature_4"
            android:textAlignment="center"
            android:textColor="@color/subscriptionFeaturesColor"
            android:textSize="@dimen/subscriptionFeaturesSize"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/cvAnnualPlan" />

        <TextView
            android:id="@+id/textView10"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:letterSpacing="0.3"
            android:text="@string/text_subscription_feature_5"
            android:textAlignment="center"
            android:textColor="@color/subscriptionFeaturesColor"
            android:textSize="@dimen/subscriptionFeaturesSize"
            app:layout_constraintEnd_toEndOf="@+id/textView9"
            app:layout_constraintStart_toStartOf="@+id/textView9"
            app:layout_constraintTop_toBottomOf="@+id/textView9" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="16dp"
            android:fontFamily="@font/raleway_semibold"
            android:letterSpacing="0.3"
            android:text="@string/button_logout"
            android:textAlignment="center"
            android:textColor="@color/logoutButtonColor"
            android:textSize="@dimen/subscriptionFeaturesSize"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="@+id/textView10"
            app:layout_constraintStart_toStartOf="@+id/textView10"
            app:layout_constraintTop_toBottomOf="@+id/textView10" />

    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

<Button
    android:id="@+id/button"
    style="@style/UnelevatedButton"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:text="@string/button_subscribe"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>

The problem is that the first two TextViews are getting cropped and an unnecessary padding is added at the bottom of the NestedScrollView.

A similar bug was filed a few months before but I think it's not solved yet.

Similar questions have been asked before, but I can't find the proper solution to it.

like image 685
Mehul Kanzariya Avatar asked Oct 20 '18 14:10

Mehul Kanzariya


People also ask

What is the difference between NestedScrollView and ScrollView?

NestedScrollView is just like ScrollView , but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. Nested scrolling is enabled by default.

Which is better RelativeLayout or ConstraintLayout?

ConstraintLayout has flat view hierarchy unlike other layouts, so does a better performance than relative layout. Yes, this is the biggest advantage of Constraint Layout, the only single layout can handle your UI.

How do I use NestedScrollView with ConstraintLayout and RecyclerView?

Just add the fillViewPort parameter to your NestedScrollView . Like that the ConstraintLayout will expand just as you'd set its width to match_parent and the RecyclerView will dynamically expand its size.

Can we use LinearLayout in ConstraintLayout?

Most of what can be done in LinearLayout and RelativeLayout can now be done with a new layout system called ConstraintLayout. It's important to note the class hierarchy of these View Layouts.


1 Answers

Try this Result https://www.youtube.com/watch?v=PTnbzCbgBTE

  <androidx.constraintlayout.widget.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/clProfileFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/appCompatImageView8"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:scaleType="fitXY"
            android:adjustViewBounds="true"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHeight_percent="0.7"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:srcCompat="@color/colorAccent" />


        <de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/ivProfileFragment"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:src="@drawable/ic_launcher_nilesh"
            android:visibility="visible"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/tvUserName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:letterSpacing="0.2"
            android:textAlignment="center"
            app:layout_constraintBottom_toBottomOf="@+id/ivProfileFragment"
            app:layout_constraintStart_toEndOf="@+id/ivProfileFragment"
            app:layout_constraintTop_toTopOf="@+id/ivProfileFragment"
            android:text="Mehul Kanzriya" />


        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/ivCloseProfileFragment"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="start"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="16dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:srcCompat="@drawable/ic_drawer" />

        <androidx.core.widget.NestedScrollView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:clipToPadding="true"
            android:fillViewport="true"
            android:fitsSystemWindows="true"
            app:layout_constraintBottom_toTopOf="@id/button"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/ivProfileFragment">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal">

                <TextView
                    android:id="@+id/textView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="8dp"
                    android:layout_marginTop="32dp"
                    android:layout_marginEnd="8dp"
                    android:letterSpacing="0.3"
                    android:text="text_subscribe"
                    android:textSize="18sp"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:id="@+id/textView2"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="16dp"
                    android:layout_marginTop="16dp"
                    android:layout_marginEnd="16dp"
                    android:letterSpacing="0.3"
                    android:text="text_subscription_feature_1"
                    android:textAlignment="center"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/textView" />

                <TextView
                    android:id="@+id/textView4"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="8dp"
                    android:letterSpacing="0.3"
                    android:text="text_subscription_feature_2"
                    android:textAlignment="center"
                    app:layout_constraintEnd_toEndOf="@+id/textView2"
                    app:layout_constraintStart_toStartOf="@+id/textView2"
                    app:layout_constraintTop_toBottomOf="@+id/textView2" />

                <TextView
                    android:id="@+id/textView5"
                    android:layout_width="0dp"
                    android:layout_height="16dp"
                    android:layout_marginTop="8dp"
                    android:letterSpacing="0.3"
                    android:text="text_subscription_feature_3"
                    android:textAlignment="center"
                    app:layout_constraintEnd_toEndOf="@+id/textView4"
                    app:layout_constraintStart_toStartOf="@+id/textView4"
                    app:layout_constraintTop_toBottomOf="@+id/textView4" />

                <androidx.appcompat.widget.AppCompatImageView
                    android:id="@+id/appCompatImageView2"
                    android:layout_width="350dp"
                    android:layout_height="168dp"
                    android:layout_marginTop="32dp"
                    app:layout_constraintEnd_toEndOf="@+id/textView5"
                    app:layout_constraintStart_toStartOf="@+id/textView5"
                    app:layout_constraintTop_toBottomOf="@+id/textView5"
                    app:srcCompat="@mipmap/ic_launcher_round" />

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/cvAnnualPlan"
                    android:layout_width="150dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="16dp"
                    android:layout_marginTop="16dp"
                    app:cardBackgroundColor="@android:color/transparent"
                    app:cardCornerRadius="14dp"
                    app:cardElevation="0dp"
                    app:layout_constraintEnd_toStartOf="@+id/cvMonthlyPlan"
                    app:layout_constraintHorizontal_chainStyle="spread"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/appCompatImageView2"
                    app:strokeWidth="3dp">

                    <com.google.android.material.card.MaterialCardView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="2dp"
                        app:cardCornerRadius="12dp"
                        app:cardElevation="0dp">

                        <androidx.constraintlayout.widget.ConstraintLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent">


                            <TextView
                                android:id="@+id/textView7"
                                android:layout_width="0dp"
                                android:layout_height="wrap_content"
                                android:letterSpacing="0.1"
                                android:padding="8dp"
                                android:text="text_subscription_most_popular"
                                android:textAlignment="center"
                                android:textColor="@android:color/white"
                                android:textSize="12sp"
                                app:layout_constraintEnd_toEndOf="parent"
                                app:layout_constraintStart_toStartOf="parent"
                                app:layout_constraintTop_toTopOf="parent" />

                            <TextView
                                android:id="@+id/textView3"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="8dp"
                                android:layout_marginTop="32dp"
                                android:layout_marginEnd="8dp"
                                android:letterSpacing="0.3"
                                android:text="ANNUAL"
                                app:layout_constraintEnd_toEndOf="parent"
                                app:layout_constraintStart_toStartOf="parent"
                                app:layout_constraintTop_toBottomOf="@+id/textView7" />

                            <TextView
                                android:id="@+id/textView6"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="8dp"
                                android:layout_marginTop="16dp"
                                android:layout_marginEnd="8dp"
                                android:text="Rs 60.00"
                                android:textColor="@android:color/white"
                                app:layout_constraintEnd_toEndOf="parent"
                                app:layout_constraintStart_toStartOf="parent"
                                app:layout_constraintTop_toBottomOf="@+id/textView3" />

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="8dp"
                                android:layout_marginTop="8dp"
                                android:layout_marginEnd="8dp"
                                android:layout_marginBottom="32dp"
                                android:letterSpacing="0.3"
                                android:text="text_per_month"
                                android:textColor="@android:color/white"
                                app:layout_constraintBottom_toBottomOf="parent"
                                app:layout_constraintEnd_toEndOf="parent"
                                app:layout_constraintStart_toStartOf="parent"
                                app:layout_constraintTop_toBottomOf="@+id/textView6" />

                        </androidx.constraintlayout.widget.ConstraintLayout>

                    </com.google.android.material.card.MaterialCardView>
                </com.google.android.material.card.MaterialCardView>

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/cvMonthlyPlan"
                    android:layout_width="150dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="8dp"
                    android:layout_marginEnd="8dp"
                    app:cardBackgroundColor="@android:color/transparent"
                    app:cardCornerRadius="14dp"
                    app:cardElevation="0dp"
                    app:layout_constraintBottom_toBottomOf="@+id/cvAnnualPlan"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@+id/cvAnnualPlan"
                    app:layout_constraintTop_toTopOf="@+id/cvAnnualPlan"
                    app:strokeWidth="3dp">

                    <com.google.android.material.card.MaterialCardView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="2dp"
                        app:cardCornerRadius="12dp"
                        app:cardElevation="0dp">

                        <androidx.constraintlayout.widget.ConstraintLayout
                            android:layout_width="match_parent"
                            android:layout_height="match_parent">


                            <TextView
                                android:id="@+id/textView8"
                                android:layout_width="0dp"
                                android:layout_height="wrap_content"
                                android:padding="8dp"
                                android:textSize="12sp"
                                app:layout_constraintEnd_toEndOf="parent"
                                app:layout_constraintStart_toStartOf="parent"
                                app:layout_constraintTop_toTopOf="parent" />

                            <TextView
                                android:id="@+id/textView44"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="8dp"
                                android:layout_marginTop="32dp"
                                android:layout_marginEnd="8dp"
                                android:letterSpacing="0.3"
                                android:text="MONTHLY"
                                app:layout_constraintEnd_toEndOf="parent"
                                app:layout_constraintStart_toStartOf="parent"
                                app:layout_constraintTop_toBottomOf="@+id/textView8" />

                            <TextView
                                android:id="@+id/textView66"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="8dp"
                                android:layout_marginTop="16dp"
                                android:layout_marginEnd="8dp"
                                android:text="Rs 70.00"
                                android:textColor="@android:color/white"
                                app:layout_constraintEnd_toEndOf="parent"
                                app:layout_constraintStart_toStartOf="parent"
                                app:layout_constraintTop_toBottomOf="@+id/textView44" />

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="8dp"
                                android:layout_marginTop="8dp"
                                android:layout_marginEnd="8dp"
                                android:layout_marginBottom="32dp"
                                android:letterSpacing="0.3"
                                android:text="text_per_month"
                                android:textColor="@android:color/white"
                                app:layout_constraintBottom_toBottomOf="parent"
                                app:layout_constraintEnd_toEndOf="parent"
                                app:layout_constraintStart_toStartOf="parent"
                                app:layout_constraintTop_toBottomOf="@+id/textView66" />

                        </androidx.constraintlayout.widget.ConstraintLayout>

                    </com.google.android.material.card.MaterialCardView>
                </com.google.android.material.card.MaterialCardView>

                <TextView
                    android:id="@+id/textView9"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="8dp"
                    android:layout_marginTop="16dp"
                    android:layout_marginEnd="8dp"
                    android:letterSpacing="0.3"
                    android:text="text_subscription_feature_4"
                    android:textAlignment="center"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/cvAnnualPlan" />

                <TextView
                    android:id="@+id/textView10"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="8dp"
                    android:letterSpacing="0.3"
                    android:text="text_subscription_feature_5"
                    android:textAlignment="center"
                    app:layout_constraintEnd_toEndOf="@+id/textView9"
                    app:layout_constraintStart_toStartOf="@+id/textView9"
                    app:layout_constraintTop_toBottomOf="@+id/textView9" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="8dp"
                    android:layout_marginTop="8dp"
                    android:layout_marginBottom="16dp"
                    android:letterSpacing="0.3"
                    android:text="button_logout"
                    android:textAlignment="center"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="@+id/textView10"
                    app:layout_constraintStart_toStartOf="@+id/textView10"
                    app:layout_constraintTop_toBottomOf="@+id/textView10" />

            </androidx.constraintlayout.widget.ConstraintLayout>
        </androidx.core.widget.NestedScrollView>

        <Button
            android:id="@+id/button"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="button_subscribe"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>
like image 146
AskNilesh Avatar answered Oct 01 '22 02:10

AskNilesh