おはようございます。本日も Android Material Components
周りで調べたことをメモがわりに書いておきます🏃🏻♂️
結論
Material Components
の TextField
の cursor color
は、どうやら設定されている Theme
の primary
になるそうです。
今回僕は該当する Activity
に primary
を設定していなかったので、Android(標準?) の primary
が適用されていたそうです。ということで cursor color
を変えるために Theme
に primary
を追加してみます。
<style name="AppDarkTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> <item name="colorPrimary">@color/fideeBlue</item> <item name="colorPrimaryDark">@color/fideeBlack</item> </style>
また、それ以外のカスタム属性(hint, inputTextColor, helperなど)は下記のドキュメントの通り、それぞれの attribute
で設定できます。
今回は僕が使用したのは Filled text field
というスタイルで、下記のような項目を atributes
からカスタム設定できます。また、この他にも Outlined Text Field
というスタイルのものもあります。
参照: https://material.io/components/text-fields#filled-text-field