簡體   English   中英

style.xml和theme.xml android studio之間的區別?

[英]Difference between style.xml and theme.xml android studio?

嘿,我正在嘗試更改操作欄的背景,但我不確定我是否理解樣式文件的結構。 所以基本上我有style.xml,它將一些元素傳遞給所需的樣式。 那么我的Theme.xml里面有一組樣式,對嗎? 如何將兩者聯系起來,換句話說,如何告訴主題我想要指定的樣式呢? 我無法改變操作欄的背景,所以這是我的代碼:

style.xml:

    <!-- Base application theme. -->
    <style name="MyActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:colorBackground">@color/color_lightBlue</item>
    </style>
</resources>

theme.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
 <style name="MyCustomTheme" parent="Theme.AppCompat.Light">

 </style>

</resources>

和wtf是v11 /風格?

無論是將屬性放在styles.xml還是theme.xml ,如果將主題應用於應用或活動,它們最終會產生相同的效果。 AndroidManifest.xml ,為了讓主題具有您想要的效果,您應該將自定義主題應用於您的應用。

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM