0

I want to have shadow in Android widget like button, edittext, searchview or anything. I have no idea about android elevation. I think it only supports from API 23. If there is any proper solution then please provide.

here is my demo widget. I need the shadow in border of my searchview.

<android.support.v7.widget.SearchView
    android:id="@+id/searchView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:backgroud="@android:color/white" />

2 Answers2

1

You can get the shadow effect by adding this to the widget:

android:background="@android:drawable/dialog_holo_light_frame"

Got the answer from here: https://stackoverflow.com/a/30931750/8466860.

0

Place your views inside CardView. Using CardView you can add elevation, rounded corners etc. It supports back till API 7.

to use CardView, add it via your app level gradle..

dependencies {

...

    compile 'com.android.support:cardview-v7:25.3.1'
}