实现button背景的半透明化

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="10dp"

    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_gravity="bottom"
        android:background="#00000000">

        <!--    主要设置Button控件为透明色   -->


        <Button
            android:id="@+id/btn_login"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="开启音乐之旅"
            android:textColor="#03A9F4"
            android:textSize="20sp"
            android:textStyle="bold"
            android:background="@drawable/login"
            android:layout_gravity="center_horizontal"/>

     
    </LinearLayout>

</LinearLayout>

---------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

            <solid android:color="#33EEEEEE"/>
            <!--颜色-->
            <corners android:radius="30dp"/>
            <!--标准圆角-->
</shape>

--------------------------------------------------------------------------------------------------------------------