LoginSignup
1
1

More than 5 years have passed since last update.

Android-Bootstrapで、BootstrapButtonに設定したtextSizeが反映されない

Last updated at Posted at 2016-05-18

問題

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>

上記のレイアウトでボタンを表示すると、以下のようになる.
ラベルがちっちゃい.

スクリーンショット 2016-05-18 16.50.35.png

解決策

アプリケーション中から setTextSize() すると通る.

MainActivity.kt
question_button.setTextSize(120.0f)
check_button.setTextSize(120.0f)

以下のようになる.

スクリーンショット 2016-05-18 16.51.05.png

memo

Issueつくって確認したところ、「こういうものだ」という回答を得た.
bootstrapSize だと5段階での設定しかできないので、任意サイズを設定したい場合は、このやり方になるらしい.

参考

1
1
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
1
1