Skip to content
项目

关于

[NO LONGER SUPPORTED]Android multifunctional lyric view

其他项目

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README_CN.md

原文

LyricView

下载 apk 体验.

博客介绍: https://www.jianshu.com/p/ab735509cc74

截图

screenshot screenshot

配置

    all projects {
	    repositories {
		    ...
		    maven { url 'https://jitpack.io' }
	    }
	}

    dependencies {
    	        implementation 'com.github.Lauzy:LyricView:VERSION_CODE'
    	}

最新的版本号,点击这里获取.

用法

Xml 文件:


       <com.lauzy.freedom.library.LrcView
            ...
            app:currentIndicateLrcColor="@color/colorAccent"
            app:indicatorTextColor="@android:color/holo_orange_dark"
            app:playIcon="@drawable/play_music"/>

功能:

解析歌词并设置歌词数据:


      从文件读取:
      List<Lrc> lrcs = LrcHelper.parseLrcFromFile(file);

      从asset资源中读取:
      List<Lrc> lrcs = LrcHelper.parseLrcFromAssets(context, assetFileName);

      设置歌词数据:
      mLrcView.setLrcData(lrcs);

根据播放进度更新歌词:


      mLrcView.updateTime(mMediaPlayer.getCurrentPosition());

通过指示器,跳转至具体的时间:


      mLrcView.setOnPlayIndicatorLineListener(new LrcView.OnPlayIndicatorLineListener() {
                 @Override
                 public void onPlay(long time, String content) {
                     mMediaPlayer.seekTo((int) time);
                 }
             });

歌词数据为空时,设置内容为空的提示:


     mLrcView.setEmptyContent("no data");

属性:


        <attr name="lrcTextSize" format="dimension"/>
        <attr name="lrcLineSpaceSize" format="dimension"/>
        <attr name="lrcNormalTextColor" format="reference|color"/>
        <attr name="lrcCurrentTextColor" format="reference|color"/>
        <attr name="lrcTouchDelay" format="integer"/>   //手动滑动后,回滚至当前播放位置的延迟
        <attr name="noLrcTextSize" format="dimension"/>
        <attr name="noLrcTextColor" format="reference|color"/>
        <attr name="indicatorLineHeight" format="dimension"/>
        <attr name="indicatorTextSize" format="dimension"/>
        <attr name="indicatorTextColor" format="reference|color"/>
        <attr name="currentIndicateLrcColor" format="reference|color"/> //当前歌词的颜色
        <attr name="indicatorTouchDelay" format="integer"/>    //指示器消失延迟
        <attr name="indicatorLineColor" format="reference|color"/> // 指示器线条颜色
        <attr name="indicatorStartEndMargin" format="dimension"/>  //指示器左右margin
        <attr name="iconLineGap" format="dimension"/>   // 指示器图标和线条的距离
        <attr name="playIconWidth" format="dimension"/>
        <attr name="playIconHeight" format="dimension"/>
        <attr name="playIcon" format="reference"/>   // 指示器图标
        <attr name="isLrcCurrentTextBold" format="boolean"/>
        <attr name="isLrcIndicatorTextBold" format="boolean"/>

协议

Copyright (c) 2017-present Lauzy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

探索相关项目

加载中…