Skip to main content
CustomButton provides XML attributes that allow you to customize the button’s appearance directly in your layout files.

Color attributes

btn_buttonColor
color | reference
The background color of the button in its normal (unpressed) state.Default: Color.WHITE
btn_buttonSelectColor
color | reference
The background color of the button when pressed or selected.Default: Same as btn_buttonColor
btn_textColor
color | reference
The text color in the button’s normal (unpressed) state.Default: Color.GRAY
btn_textSelectColor
color | reference
The text color when the button is pressed or selected.Default: Same as btn_textColor
btn_strokeColor
color | reference
The outline/border color in the button’s normal (unpressed) state.Default: Color.GRAY
btn_strokeSelectColor
color | reference
The outline/border color when the button is pressed or selected.Default: Same as btn_strokeColor

Shape attributes

btn_strokeWidth
dimension | reference
The width of the button’s outline/border in pixels.Default: 2px
btn_cornerRadius
dimension | reference
The corner radius of the button in pixels. Higher values create more rounded corners.Default: 40px

Usage example

<stream.custombutton.CustomButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Click Me"
    app:btn_buttonColor="#FF6200EE"
    app:btn_buttonSelectColor="#FF3700B3"
    app:btn_textColor="#FFFFFF"
    app:btn_textSelectColor="#FFCCCCCC"
    app:btn_strokeColor="#FF3700B3"
    app:btn_strokeSelectColor="#FF6200EE"
    app:btn_strokeWidth="4dp"
    app:btn_cornerRadius="16dp" />
This creates a purple button with white text, rounded corners, and a visible stroke that changes color when pressed.

Build docs developers (and LLMs) love