Android Small Button

Aug 27, 2019
<Button
    android:id="@+id/smallButton"
    android:text="Small"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="10sp"
    android:paddingStart="0dp"
    android:paddingEnd="0dp"
    android:minHeight="0dp"
    style="?android:attr/buttonStyleSmall"
    />

or you can create a style.

Add the following at res/values/styles.

<resources>

    ...

    <style name="AppSmallButton" parent="Widget.AppCompat.Button.Small">

        <item name="android:minHeight">0dp</item>
        <item name="android:paddingStart">2dp</item>
        <item name="android:paddingEnd">2dp</item>
        <item name="android:textSize">10dp</item>
    </style>

</resources>
<Button
    android:id="@+id/smallButton"
    android:text="Small"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    style="@style/AppSmallButton"
    />

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.