當前位置:首頁 » 安卓系統 » 安卓如何添加頁面背景透明度

安卓如何添加頁面背景透明度

發布時間: 2024-12-05 04:16:04

『壹』 android 怎麼給一塊區域設置背景半透明

activity的背景透明,只需在只要在配置文件內activity屬性配置內加上android:theme="@android:style/Theme.Translucent"就好了。
但是想要多方面的設置theme的話,就要在values里設置風格先:
加透明:
先在res/values下建colors.xml文件,寫入:
<?xmlversionxmlversion="1.0"encoding="UTF-8"?>
<resources>
<colornamecolorname="transparent">#9000</color><!--透明度-->
</resources>
這個值設定了整個界面的透明度,為了看得見效果,現在設為透明度為56%(9/16)左右。
透明度可以用#9000值調,將這個值(ARGB)改變,就會有不同效果的透明度。
再在res/values/下建styles.xml,設置程序的風格
<?xmlversionxmlversion="1.0"encoding="utf-8"?>
<resources>
<stylenamestylename="Transparent">
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>
</style>
</resources>
加了@+android:style/Animation.Translucent這句的時候就會顯示出此activity會有動畫切換效果
最後一步,把這個styles.xml用在相應的Activity上。即在AndroidManifest.xml中的任意標簽中添加 android:theme="@style/transparent"
如果要設置所有的activity都使用這個風格,就把這句標簽語句添加在中。

熱點內容
qml文件修改後編譯未生效 發布:2025-05-14 07:31:00 瀏覽:330
內到內演算法 發布:2025-05-14 07:29:11 瀏覽:33
文件夾名字不顯示 發布:2025-05-14 07:27:47 瀏覽:774
oracle的資料庫驅動jar 發布:2025-05-14 07:23:20 瀏覽:555
我的世界電腦版伺服器手機版能進嗎 發布:2025-05-14 07:22:01 瀏覽:678
達內培訓php多少錢 發布:2025-05-14 07:19:10 瀏覽:26
python位元組轉字元串 發布:2025-05-14 07:06:35 瀏覽:421
subplotpython 發布:2025-05-14 06:53:51 瀏覽:661
豎屏大屏導航工廠密碼一般是多少 發布:2025-05-14 06:49:29 瀏覽:806
如何在手機里設置無線網密碼 發布:2025-05-14 06:47:54 瀏覽:120