自定义EditText背景白色删除

我想从editText搜索栏中删除背景白色。我希望搜索栏似乎漂浮在上方。请任何人帮助...这是的屏幕截图。

search_input_style.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <corners android:radius="32dp" />
    <padding android:top="12dp" android:left="12dp"
        android:bottom="12dp" android:right="12dp" />
</shape>

EditText xml代码

  <EditText
        android:id="@+id/search_input"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="24dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="16dp"
        android:background="@drawable/search_input_style"
        android:backgroundTint="#D8EBB5"
        android:drawableLeft="@drawable/ic_search_gray_24dp"


        android:hint="search"
        android:inputType="textPersonName"
        android:textColor="@color/content_text_color"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
评论
  • Ctrl
    Ctrl 回复

    To elevate you can use . android:elevation="10dp" And set the background color of EditText parent view as android:background="#D8EBB5" If it doesn't work then provide your full xml code.

  • HM
    HM 回复

    如果我理解正确,则需要将EditText父级的背景色更改为#D8EBB5。

    You didn't provide the entire XML code, but just try setting android:background="#D8EBB5" to the first EditText's parent background.