AndroidのButtonでアルファベットテキストが全部大文字になる
はじめに
Androidを実装していて困ったのが、Buttonのテキストです。
英語で記述したテキストが全て大文字になってしまうのです。
大文字小文字を区別したいのに...地味に困ります。
対策
大文字小文字を区別したい時の解決策は、レイアウトxmlでandroid:textAllCaps="false"
と指定してあげることです。
ボタンテキストは大文字固定がデフォルトになっているようです。
- 修正前
activity_main.xml
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hoge" />
- 修正後
activity_main.xml
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hoge"
android:textAllCaps="false" /> //textAllCapsを指定する
もちろん、コードを書いて指定することもできます。
MainActivity.java
Button button = findViewById(R.id.button);
button.setAllCaps(false);
Author And Source
この問題について(AndroidのButtonでアルファベットテキストが全部大文字になる), 我々は、より多くの情報をここで見つけました https://qiita.com/keyoris/items/97c37ce743100cb6dcee著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .