Android 的 theme 是比 style 更大範圍的 UI 美化機制,可套用到整個應用程式或單一 Activity,例如隱藏標題列、變更背景顏色與整體視覺風格。
在 style.xml 中新增:
<style name="myTheme">
<item name="android:windowNoTitle">true</item>
<item name="android:background">#087832</item>
</style>在 AndroidManifest.xml 的 application 節點加入 theme 屬性:
<application
android:theme="@style/myTheme"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
...
</application>若只想套用到單一 Activity,也可在 activity 標籤中設定 android:theme。theme 與 style 搭配使用,能讓 Android 介面更具一致性與品牌感。