### LyricView Java API Methods Reference Source: https://github.com/asr-pub/lyricviewdemo/blob/master/Readme.md This section provides a comprehensive reference for the public methods available in the LyricView class. These methods allow programmatic control over lyric display, including setting the lyric file, updating playback progress, configuring alignment, and handling user interactions through listeners. ```APIDOC Methods: setOnPlayerClickListener(OnPlayerClickListener listener): Callback when click the play icon setAlignment(@Alignment int alignment): Set the alignment of the lyrics setCurrentTimeMillis(long current): Scroll lyrics to the specify TimeMillis setLyricFile(File file): Set the lyric file, and auto set the charset by `juniversalchardet-1.0.3` setLyricFile(File file, String charset): Set the lyric file with the specified charset setTypeface(Typeface typeface): Set the typeface of lyrics reset(): Reset the LyricView ``` -------------------------------- ### Initialize and Use LyricView in Java Source: https://github.com/asr-pub/lyricviewdemo/blob/master/Readme.md After defining LyricView in XML, initialize it in your Java code by finding its ID. Then, set the lyric file using `setLyricFile` and continuously update the current playback time with `setCurrentTimeMillis`. Additionally, implement `OnPlayerClickListener` to handle user interactions like dragging lyrics or clicking the play icon. ```Java LyricView mLyricView = (LyricView)findViewById(R.id.custom_lyric_view); mLyricView.setLyricFile(lyricFile); mLyricView.setCurrentTimeMillis(progress); mLyricView.setOnPlayerClickListener(new LyricView.OnPlayerClickListener() { @Override public void onPlayerClicked(long progress, String content) { } }); ``` -------------------------------- ### Add Gradle Dependency for LyricView Source: https://github.com/asr-pub/lyricviewdemo/blob/master/Readme.md To integrate LyricView into your Android project, first add the JitPack repository to your project's build file, then include the LyricViewDemo library as a compile dependency in your module's build.gradle file. This step ensures all necessary components are downloaded and available for use. ```Gradle allprojects { repositories { ... maven { url 'https://jitpack.io' } } } dependencies { compile 'com.github.zhengken:LyricViewDemo:v1.2' } ``` -------------------------------- ### LyricView XML Attributes Reference Source: https://github.com/asr-pub/lyricviewdemo/blob/master/Readme.md This section details the customizable XML attributes available for the LyricView component. These attributes allow developers to configure the appearance and behavior of the lyric display directly within their layout files, controlling aspects like text size, color, alignment, and fade effects. ```APIDOC Attributes: fadeInFadeOut: boolean (Default: false) - Enable lyrics fadeInFadeOut or not hint: string (Default: No Lyrics) - Display when not exist lyric file hintColor: color (Default: #FFFFFF) - The color of hint text textSize: dimension (Default: 16sp) - The text size of lyrics textColor: color (Default: #8D8D8D) - The color of lyrics highlightColor: color (Default: #FFFFFF) - The color of current lyric that playing textAlign: enum (Default: CENTER) - The alignment of lyrics maxLength: dimension (Default: 300dp) - Line feed when lyric'width beyond maxLength lineSpace: dimension (Default: 25dp) - Line space ``` -------------------------------- ### Integrate LyricView into XML Layout Source: https://github.com/asr-pub/lyricviewdemo/blob/master/Readme.md To display the LyricView in your Android application, declare it as a custom view in your XML layout file. Assign an ID to the view to reference it programmatically later. This sets up the visual component within your activity or fragment. ```XML ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.