开发者

How to Set JPG/PNG file as a Theme?

开发者 https://www.devze.com 2023-03-29 20:02 出处:网络
How to S开发者_高级运维et JPG/PNG file as a Theme of Mobile?Create drawable/background.xml: <?xml version=\"1.0\" encoding=\"utf-8\"?>

How to S开发者_高级运维et JPG/PNG file as a Theme of Mobile?


Create drawable/background.xml:

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/icon" />

Create values/styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomTheme" parent="android:Theme.Light">
    <item name="android:windowBackground">@drawable/background</item>
</style>
</resources>

And apply this theme to your activity or application in manifest.xml:

android:theme="@style/CustomTheme"

This theme applies the default image (icon.png) to the property windowBackground.

0

精彩评论

暂无评论...
验证码 换一张
取 消