Skip to content
Advertisement

Transparent EditText Android Studio

I am trying to make my EditText in my android studio project transparent. I want it to look like the EditText here

But mine doesn’t look like that even though I have tried using transparent and ffffff can someone please help me with this ? I want my edit text background to look like the one in the image I showed.

Advertisement

Answer

<EditText
        android:layout_width="match_parent"
        android:layout_margin="32dp"
        android:layout_height="wrap_content"
        android:hint="Username"
        android:padding="16dp"
        android:background="@drawable/edittext_bg" />

edittext_bg.xml in drawables folder:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#80ffffff" />
    <corners android:radius="5dp" />
</shape>

Change color value of <solid android:color="#80ffffff" /> to adjust transparency.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement