美文网首页
lyricView--歌词显示控件

lyricView--歌词显示控件

作者: 卖梦为生_若愚 | 来源:发表于2017-06-22 16:20 被阅读0次

原项目地址:https://github.com/zhengken/LyricViewDemo

dependencies {

compile 'com.github.zhengken:LyricViewDemo:v1.0'

}

XML code

//step 1

android:id="@+id/custom_lyric_view"

android:layout_width="match_parent"

android:layout_height="match_parent" />

Java code

//step 2

LyricView mLyricView = (LyricView)findViewById(R.id.custom_lyric_view);

//step 3

mLyricView.setLyricFile(lyricFile);

//step 4, update LyricView every interval

mLyricView.setCurrentTimeMillis(progress);

//step 5, implement the interface when user drag lyrics and click the play icon

mLyricView.setOnPlayerClickListener(new LyricView.OnPlayerClickListener() {

@Override

public void onPlayerClicked(long progress, String content) {

}

});

XML attributes

AttributesFormatDefaultDescription

fadeInFadeOutbooleanfalseEnable lyrics fadeInFadeOut or not

hintstringNo LyricsDisplay when not exist lyric file

hintColorcolor#FFFFFFThe color of hint text

textSizedimension16spThe text size of lyrics

textColorcolor#8D8D8DThe color of lyrics

highlightColorcolor#FFFFFFThe color of current lyric that playing

textAlignenumCENTERThe alignment of lyrics

maxLengthdimension300dpLine feed when lyric'width beyond maxLength

lineSpacedimension25dpLine space

Java API

MethodsDescription

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

Thanks

相关文章

  • lyricView--歌词显示控件

    原项目地址:https://github.com/zhengken/LyricViewDemo dependenc...

  • Android自定义歌词控件实现

    记一下自己在项目中用到的歌词控件实现思路控件效果类似于目前网易云播放器的歌词显示,大概是这样: 控件支持: 正在播...

  • Android播放器歌词显示控件

    --layout: blogtitle: 'Android播放器歌词显示控件'date: 2017-07-04 1...

  • 所有UI控件显示不出来的原因

    我们创建一些UI控件时候,经常会遇到控件不显示。这里我为大家写出所有UI控件显示不出来原因,如果你遇到控件不显示,...

  • 2.9 显示控件

    我们的输入控件终于结束了,今天小豆君来介绍显示控件。 2.9.1 QLabel 标签控件 标签控件可以用来显示文本...

  • 2.6 容器控件(一)

    今天及后面几天,小豆君主要来讲一下Qt其它常用控件的用法。主要包括: 容器控件 按钮控件 输入控件 显示控件显示控...

  • Android中的Switch控件样式设置

    首先添加控件: 以下是该控件的常用属性:textOn:控件打开时显示的文字textOff:控件关闭时显示的文字th...

  • [转]自定义LyricView实现歌词显示控件

    原文地址 | 源码地址 | 加入“小知”Tower协作团队 注:原文的代码阅读和拷贝起来不太方便,我已经摘录出来。...

  • 收集一些Android常用的功能库(不定期更新)

    实现控件的各种阴影效果image.png 实时显示音乐播放频率的控件image.png 实时显示音乐播放频率的控件...

  • QQ粘性效果

    动画分析 当前控件既可以显示图片,有可以显示文字,那么我们就可以通过按钮来最为当前的控件. 当拖动控件,当前控件尺...

网友评论

      本文标题:lyricView--歌词显示控件

      本文链接:https://www.haomeiwen.com/subject/haufcxtx.html