Android studio Button半透明實現


實現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>

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM