LoginSignup
38
26

More than 5 years have passed since last update.

Androidのthemeで指定できるcolors属性一覧

Last updated at Posted at 2019-01-24

Androidのthemeでは、色々な色を指定できます。必要に応じて editTextStyle のようにWidgetごとのstyleやthemeを指定することもありますが、どのようなcolors属性を指定できるのかをざっと知っておくといざという時に便利です。

大まかに Android PlatformAppCompatMaterial Componentsあたりを網羅できればいいと思うのですが、定義が多すぎて整理しづらかったのでcolor関連の属性だけ集めてMarkdownのテーブルにするスクリプトを書きました。
https://github.com/konifar/android-theme-attrs-to-markdown-table

android_framework のみに◯がついているものは、属性の指定時に android: namespaceが必要です。全体でどんな属性があるのか、MaterialComponentsのみ指定できる属性にはどんなものがあるのか、といったことは把握できると思います。それぞれの属性の説明については、各attrs.xmlのコメントに記載されています。


attr name android_framework appcompat material_components
actionMenuTextColor
colorAccent
colorActivatedHighlight
colorBackground
colorBackgroundCacheHint
colorBackgroundFloating
colorButtonNormal
colorControlActivated
colorControlHighlight
colorControlNormal
colorEdgeEffect
colorError
colorFocusedHighlight
colorForeground
colorForegroundInverse
colorLongPressedHighlight
colorMultiSelectHighlight
colorOnBackground
colorOnError
colorOnPrimary
colorOnSecondary
colorOnSurface
colorPressedHighlight
colorPrimary
colorPrimaryDark
colorPrimaryVariant
colorProgressBackgroundNormal
colorSecondary
colorSecondaryVariant
colorSurface
colorSwitchThumbNormal
editTextColor
fastScrollTextColor
floatingToolbarDividerColor
floatingToolbarForegroundColor
panelColorBackground
panelColorForeground
textColorAlertDialogListItem
textColorHighlightInverse
textColorHintInverse
textColorLinkInverse
textColorPrimary
textColorPrimaryActivated
textColorPrimaryDisableOnly
textColorPrimaryInverse
textColorPrimaryInverseDisableOnly
textColorPrimaryInverseNoDisable
textColorPrimaryNoDisable
textColorSearchUrl
textColorSecondary
textColorSecondaryActivated
textColorSecondaryInverse
textColorSecondaryInverseNoDisable
textColorSecondaryNoDisable
textColorTertiary
textColorTertiaryInverse
textUnderlineColor
tooltipBackgroundColor
tooltipForegroundColor

以上。

38
26
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
38
26