EditText elevation works in xml, but doesn't work on the device. It looks normal in Android studio. The shadow is missing when the app is launched in a device.
<EditText
android:id="@ id/edit_text_search_product"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@drawable/background_edit_text_search"
android:drawableStart="@drawable/ic_search_loop"
android:hint="Product"
android:fontFamily="sans-serif-condensed-light"
android:inputType="text"
android:maxLines="1"
android:drawablePadding="16dp"
android:padding="12dp"
android:elevation="16dp"
app:layout_constraintEnd_toEndOf="@id/guide_line_end"
app:layout_constraintStart_toStartOf="@id/guide_line_start"
app:layout_constraintTop_toBottomOf="@id/text_view_search_screen_title" />
CodePudding user response:
Elevation attribute only works on API 21 and higher. Is your API lower than 21? And can you please try to add a background color to your background_edit_text_search layout just in case if it doesn't have a solid color.
CodePudding user response:
try to use AppcompatEdittext
instead. and make sure that you set a backgorund which is not transparent.
android:background="@color/colorWhite"