14
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android 5.0のテーマでボタンが大文字のみになっているのを解除する方法

Posted at

Android 5.0向けにプロジェクトを作ってボタンを配置してみたら、英字が大文字のみになってしまっていたのでそれを解除する方法。

にあるように、これは5.0のテーマで決められてしまっているらしい。

ひとまずその他の要素には触れたくなかったので、res/style.xmlに

<style name="Button2" parent="Base.Widget.AppCompat.Button">
        <item name="textAllCaps">false</item>
</style>

を追加して、これをButtonのStyleに指定する。
parentに指定したスタイルを引き継いで上書きしてくれるよう。

テーマまるごとに適用したいときは、その上のAppThemeに

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
        <item name="android:buttonStyle">@style/Button2</item>
    </style>

というようにbuttonStyleを追加する。

14
17
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
14
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?