1. 程式人生 > >如何修改android 預設的actionbar(Theme)

如何修改android 預設的actionbar(Theme)

在使用AS新建專案後,系統或自動生成APP的主題及我們在配置檔案裡看到的:

android:theme="@style/AppTheme"

所以要修改actionbar就要從配置檔案入手。在本例中我們將滑鼠游標移至AppTheme字元處,然後使用快捷鍵Ctrl+B檢視其描述:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

</resources>

這個其實就是res/values/styles.xml檔案的內容。我們只要修改其中的DarkActionBar為NoActionBar即可。

當然如果你要修改其他的都可以在這個檔案下進行。