Skip to content

Commit 60576d9

Browse files
committed
modify readme.md
1 parent 5a2a5c7 commit 60576d9

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

Readme.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,56 @@
1-
zhengken's first open source software
1+
# LyricView
2+
LyricView is a powerful and flexible custom view to display lyrics within music player under Android
3+
## Screenshot
4+
![](/screenshot/lyricview.png)
5+
[LyricViewDemo.apk][1]
6+
## Usage
7+
### Gradle dependency
8+
### XML code
9+
//step 1
10+
<me.zhengken.lyricview.LyricView
11+
android:id="@+id/custom_lyric_view"
12+
android:layout_width="match_parent"
13+
android:layout_height="match_parent" />
14+
### Java code
15+
//step 2
16+
LyricView mLyricView = (LyricView)findViewById(R.id.custom_lyric_view);
17+
18+
//step 3
19+
mLyricView.setLyricFile(lyricFile);
20+
21+
//step 4, update LyricView every interval
22+
mLyricView.setCurrentTimeMillis(progress);
23+
24+
//step 5, implement the interface when user drag lyrics and click the play icon
25+
mLyricView.setOnPlayerClickListener(new LyricView.OnPlayerClickListener() {
26+
@Override
27+
public void onPlayerClicked(long progress, String content) {
28+
29+
}
30+
});
31+
### XML attributes
32+
|Attributes|Format|Default|Description|
33+
|:--|:--|:--|:--|
34+
|fadeInFadeOut|boolean|false|Enable lyrics fadeInFadeOut or not|
35+
|hint|string|No Lyrics|Display when not exist lyric file|
36+
|hintColor|color|`#FFFFFF`|The color of hint text|
37+
|textSize|dimension|16sp|The text size of lyrics|
38+
|textColor|color|`#8D8D8D`|The color of lyrics|
39+
|highlightColor|color|`#FFFFFF`|The color of current lyric that playing|
40+
|textAlign|enum|CENTER|The alignment of lyrics|
41+
|maxLength|dimension|300dp|Line feed when lyric'width beyond maxLength|
42+
|lineSpace|dimension|25dp|Line space|
43+
### Java API
44+
|Methods|Description|
45+
|:--|:--|
46+
|`setOnPlayerClickListener(OnPlayerClickListener listener)`|Callback when click the play icon|
47+
|`setAlignment(@Alignment int alignment)`|Set the alignment of the lyrics|
48+
|`setCurrentTimeMillis(long current)`|Scroll lyrics to the specify TimeMillis|
49+
|`setLyricFile(File file)`|Set the lyric file, and auto set the charset by `juniversalchardet-1.0.3`|
50+
|`setLyricFile(File file, String charset)`|Set the lyric file with the specified charset|
51+
|`setTypeface(Typeface typeface)`|Set the typeface of lyrics|
52+
|`reset()`|Reset the LyricView|
53+
## License
254

3-
![](/screenshot/lyricview.png)
55+
56+
[1]: https://github.com/zhengken/LyricViewDemo/tree/master/sample

sample/app-debug.apk

2.81 MB
Binary file not shown.

0 commit comments

Comments
 (0)