Skip to content

⏹️ An easy to use `TextButton` when you need a TextView-like button, with handy touch feedback effects.

License

Notifications You must be signed in to change notification settings

duanhong169/TextButton

Repository files navigation

Text Button gitHub release platform Android Arsenal license Build status

An easy to use TextButton when you need a TextView-like button, with handy touch feedback effects.

screen-record

Gradle

dependencies {
    implementation 'com.github.duanhong169:text-button:${latestVersion}'
    ...
}

Replace ${latestVersion} with the latest version code. See releases.

Usage

Use the built-in effects

Config TextButton in xml:

<top.defaults.view.TextButton
    android:id="@+id/button3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="animateTextColor"
    android:padding="4dp"
    android:textSize="16sp"
    app:defaultTextColor="@android:color/holo_blue_dark"
    app:pressedTextColor="@android:color/holo_orange_dark"
    app:disabledTextColor="@android:color/darker_gray"
    app:underline="true"
    app:effectDuration="200"
    app:textEffect="animateColor"
    app:backgroundEffect="ripple"/>

There are 4 text effects: default, animateColor, animateSize and animateColorAndSize and 3 background effects: colorState, ripple, animateColor for now.

See top_defaults_view_attrs.xml for all supported attributes.

Implement your own effect

button5.setEffect(new TextButtonEffect() {
    private TextButton textButton;

    @Override
    public void init(TextButton textButton) {
        this.textButton = textButton;
    }

    @Override
    public void actionDown() {
        textButton.setAlpha(0.5f);
    }

    @Override
    public void actionUp() {
        textButton.setAlpha(1);
    }
});

For more details, see the sample app.

License

See the LICENSE file.

About

⏹️ An easy to use `TextButton` when you need a TextView-like button, with handy touch feedback effects.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy