how can i give shadow to the com.google.android.material.textfield.TextInputLayout?

Viewed 602

I tried with elevation but not getting shadow to the upper portion of TextInputLayout. I want to get shadow like below picture:

enter image description here

Is there any way to get this shadow?

1 Answers

how can i give shadow to the com.google.android.material.textfield.TextInputLayout?

You can wrap your TextInputLayout inside Cardview

SAMPLE CODE

<androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardCornerRadius="20dp"
        app:cardElevation="10dp">

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/textField"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="User name">

            <com.google.android.material.textfield.TextInputEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

        </com.google.android.material.textfield.TextInputLayout>
    </androidx.cardview.widget.CardView>
Related