Buttons are a core part of any Android app’s UI. But default buttons? They’re often boring. In this post, you’ll learn how to create beautiful, modern, and creative button styles using only XML — no third-party libraries needed!
✅ Why Customize Buttons?
Custom buttons:
- Improve user experience
- Match your app’s theme
- Increase UI engagement
- Make your app stand out
🔸 1. Flat Rounded Button
res/drawable/rounded_button.xml
:
🔸 2. Gradient Button
res/drawable/gradient_button.xml
:
🔸 3. Outlined Button
res/drawable/outline_button.xml
:
🔸 4. Pill-Shaped Button
res/drawable/pill_button.xml
:
🔸 5. Neumorphic Button (Soft Shadow)
res/drawable/neumorph_button.xml
:
🔸 6. Danger/Alert Button (Red)
res/drawable/alert_button.xml
:
🔸 7. Disabled Button Style
res/drawable/disabled_button.xml
:
🔸 8. Icon Button with Text
🔸 9. Transparent Button with Border
res/drawable/transparent_button.xml
:
🔸 10. Shadow Button (Material Look)
⚙️ Tips for Using Custom Buttons
- Use styles.xml to avoid repeating XML code
- Test buttons on light & dark themes
- Ensure good color contrast for accessibility
- Add ripple effect using
android:foreground="?attr/selectableItemBackground"
🔚 Conclusion
Custom buttons are easy to implement and instantly upgrade your app’s look. Use these XML examples in your next project to stand out — and don’t forget to share this post with your dev friends!