DEV Community

Alex Devson
Alex Devson

Posted on

Android Buttons Are Ugly by Default — BetterAndroidButton Fixes That

Let's be honest — the default Android Button is hideous. A flat rectangle with ALL CAPS text and zero personality. Every Material Design app ends up with custom button XML files scattered everywhere.

BetterAndroidButton gives you beautiful, customizable buttons with a single XML tag.

The Problem

To make a decent-looking button in Android, you typically need:

  • A custom shape drawable XML
  • A color state list XML
  • A ripple effect drawable
  • Custom text styling
  • Sometimes a separate file for each button style

That's 3-5 files just for ONE button design. Multiply that by every button variant in your app.

The Solution

BetterAndroidButton wraps all of that into a single custom view with XML attributes:

<com.p32929.betterandroidbutton.BetterButton
    android:text="Click Me"
    app:bb_backgroundColor="#6200EE"
    app:bb_textColor="#FFFFFF"
    app:bb_cornerRadius="12dp"
    app:bb_shadowEnabled="true" />
Enter fullscreen mode Exit fullscreen mode

One tag. No extra drawable files. No state lists.

Features

  • 🎨 Custom background colors
  • 📐 Adjustable corner radius (per corner!)
  • 🌊 Built-in ripple effects
  • 🌗 Shadow/elevation support
  • 📏 Custom padding and margins
  • ✍️ Font customization
  • 🔘 Icon support (left, right, top, bottom)
  • 🎭 State handling (pressed, disabled, focused)

Why Not Use Material Button?

Material Button is great if your entire app follows Material Design. But if you need custom designs that don't fit Material's opinionated styles, you're back to writing custom drawables.

BetterAndroidButton is style-agnostic. Make your buttons look however your designer wants.

Get It

github.com/p32929/BetterAndroidButton

Zero dependencies. Drop it in and start making beautiful buttons. Star it if you're tired of ugly Android defaults!

Top comments (0)