Friday, February 7, 2020

Material design Edit text in Android

Then you can easily create without any third-party library. They are actually cards (search bar cards). So we will also use CardView. You simply need to put your EditText inside CardView and you are done.
But if you do so, then you will see underline below Material design Edit text which will not look like google map’s search card. So the trick is set background of EditText to any color and your problem is solved.
<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="24dp">
    <EditText
        android:id="@+id/search"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white"
        android:hint="Search ..."
        android:textSize="14sp"
        android:padding="8dp" />
</android.support.v7.widget.CardView>
output:
Material design Edit text (Carded) in Android