問題
Android-Bootstrap を使って、BootstrapButton のラベルとして、以下のように fontAwesomeIcon を割り当てて、 textSize を設定するも、ラベルの大きさを変更することができない.
activity_main.xml
<LinearLayout
android:id="@+id/button_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal">
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="@+id/question_button"
app:fontAwesomeIcon="fa_question_circle"
app:bootstrapBrand="danger"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:textSize="120sp" />
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="@+id/check_button"
app:fontAwesomeIcon="fa_check_circle"
app:bootstrapBrand="success"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:textSize="120sp" />
</LinearLayout>
上記のレイアウトでボタンを表示すると、以下のようになる.
ラベルがちっちゃい.
解決策
アプリケーション中から setTextSize()
すると通る.
MainActivity.kt
question_button.setTextSize(120.0f)
check_button.setTextSize(120.0f)
以下のようになる.
memo
Issueつくって確認したところ、「こういうものだ」という回答を得た.
bootstrapSize だと5段階での設定しかできないので、任意サイズを設定したい場合は、このやり方になるらしい.