ColorTrackView Documentation

repository·master·Indexed 19 days ago

https://github.com/hongyangandroid/colortrackview

A custom Android view that provides animated color transitions for text or images, allowing them to gradually change from an original color to a target color.

Tokens
557
Snippets
2
Records
2
Agent score
16%

What's inside ColorTrackView

  1. Integrate ColorTrackView into Android Layouts

    master

    To use ColorTrackView, add the view to your XML layout file. You must define a custom namespace (e.g., xmlns:zhy="http://schemas.android.com/apk/res-auto") to access its custom attributes.

    ColorTrackView provides an animation effect where text or images gradually change color or fade.

    <com.zhy.view.ColorTrackView
            android:id="@+id/id_changeTextColorView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_centerVertical="true"
            android:padding="20dp"
            android:background="#44ff0000"
            android:gravity="center_vertical"
            zhy:progress="0"
            zhy:direction="left"
            zhy:text="张鸿洋"
            zhy:text_change_color="#ffff0000"
            zhy:text_origin_color="#ff000000"
            zhy:text_size="60sp" />
  2. Reference ColorTrackView XML Attributes

    master

    The following attributes are available for configuring ColorTrackView via XML (using the zhy namespace prefix):

    * progress: [0.0f , 1.0f] - The current animation progress.
    * text: The text to be drawn.
    * text_change_color: The target color for the animation.
    * text_origin_color: The original color of the text.
    * text_size: The font size.
    * direction: The direction of the color transition. Supported values: left, right, top, bottom.