全透明背景

全透明背景

<style name="Transparent_Dialog" parent="android:style/Theme.Dialog">
     <!--背景顏色及透明程度-->
     <item name="android:windowBackground">@android:color/transparent</item>
     <!--是否有標(biāo)題 -->
     <item name="android:windowNoTitle">true</item>
     <!--是否浮現(xiàn)在activity之上-->
     <item name="android:windowIsFloating">true</item>
     <!--是否模糊-->
     <item name="android:backgroundDimEnabled">false</item>
     <!--是否顯示邊框-->
     <item name="android:windowFrame">@null</item>
 </style>

progressbar.xml

<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="@dimen/progress_bar_size"
    android:layout_height="@dimen/progress_bar_size"
    android:background="@drawable/dialog_loading_background"
    android:indeterminateDrawable="@drawable/progress_bar_drawable"
    android:padding="@dimen/default_padding_margin" />

dialog_loading_background.xml

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

    <!-- 設(shè)置四個(gè)角的半徑 -->
    <corners android:radius="16dp"/>

    <!-- 填充 -->
    <solid android:color="#66000000"/>

   
</shape>

progress_bar_drawable.xml

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromDegrees="0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toDegrees="720">

    <shape
        android:innerRadiusRatio="3"
        android:shape="ring"
        android:thicknessRatio="15"
        android:useLevel="false">

        <gradient
            android:centerY="0.50"
            android:endColor="#FFFFFF"
            android:startColor="#999999"
            android:type="sweep"
            android:useLevel="false" />
    </shape>

</rotate> 

android:innerRadiusRatio="3" 表示內(nèi)環(huán)半徑為環(huán)半徑除以3
android:thicknessRatio="15" 表示環(huán)厚度為環(huán)半徑除以15
gradient是shape的顏色漸變屬性,type有三類(lèi),linear是線(xiàn)性,radial是由中心向外漸變的,sweep是掃描式漸變
android:useLevel:只有當(dāng)我們的shape使用在LevelListDrawable中的時(shí)候,這個(gè)值為true,否則為false

取寬度的20%和高度的80%的位置 android:centerX="0.2" android:centerY="0.8"
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容