AndroidのThemeで迷ったら見る資料

AndroidのThemeは、新規プロジェクトを始めると毎回調べている気がするので、お世話になった資料をまとめておきます。

# 基本的なパラメータ(colorPrimaryなど)が適用される箇所

![G1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/54/3ded3168-c184-3e1b-81b0-f7bb5686c7e3.png)
via [Android テーマ「Material」での色設定１](http://www.phenomena.co.jp/blog/2015/07/17/android-%E3%83%86%E3%83%BC%E3%83%9E%E3%80%8Cmaterial%E3%80%8D%E3%81%A7%E3%81%AE%E8%89%B2%E8%A8%AD%E5%AE%9A%EF%BC%91/)

# Material Componentの公式ドキュメント

- [Color Theming - Material Components for Android](https://material.io/develop/android/theming/color/)
- [Dark Theme - Material Components for Android](https://material.io/develop/android/theming/dark/)
- [Shape Theming - Material Components for Android](https://material.io/develop/android/theming/shape/)
- [Typography Theming - Material Components for Android](https://material.io/develop/android/theming/typography/)

# コードサンプル via DroidKaigi2019

DroidKaigi/conference-appは実装コードを見たかったらまずは探しに行く、くらい超絶参考になります。

```xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Base application theme. -->
    <style name="Platform.AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
    </style>

    <style name="AppTheme" parent="Platform.AppTheme">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorSecondary">@color/colorSecondary</item>
        <item name="colorAccent">@color/colorPrimary</item>
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:statusBarColor">@android:color/transparent</item>
        <item name="searchViewStyle">@style/SearchViewStyle</item>
        <item name="filterChipStyle">@style/Widget.App.FilterChip</item>

        <!-- see https://github.com/material-components/material-components-android/blob/2997b6995f32bbd7f7a4f24f4030278a50c15e6f/docs/theming/Typography.md -->
        <item name="textAppearanceHeadline5">@style/TextAppearance.App.Headline5</item>
        <item name="textAppearanceHeadline6">@style/TextAppearance.App.Headline6</item>
        <item name="textAppearanceSubtitle1">@style/TextAppearance.App.Subtitle1</item>
        <item name="textAppearanceSubtitle2">@style/TextAppearance.App.Subtitle2</item>
        <item name="textAppearanceBody1">@style/TextAppearance.App.Body1</item>
        <item name="textAppearanceBody2">@style/TextAppearance.App.Body2</item>
        <item name="textAppearanceCaption">@style/TextAppearance.App.Caption</item>
    </style>

    <style name="AppTheme.WithActionBar">
        <item name="windowActionBar">true</item>
        <item name="windowNoTitle">false</item>
        <item name="colorPrimary">@android:color/white</item>
    </style>

    <style name="SearchViewStyle" parent="Widget.AppCompat.SearchView">
        <item name="searchHintIcon">@null</item>
    </style>
</resources>
```
via [conference-app-2019/themes.xml](https://github.com/DroidKaigi/conference-app-2019/blob/94a9955b319720cacfd28975ba9fb4698f043631/corecomponent/androidcomponent/src/main/res/values/themes.xml)

他のvalues内のxmlは以下から見れます。

[conference-app-2019/corecomponent/androidcomponent/src/main/res/values ](https://github.com/DroidKaigi/conference-app-2019/tree/94a9955b319720cacfd28975ba9fb4698f043631/corecomponent/androidcomponent/src/main/res/values)