[小建议] 歌词显示相关建议
zhuangmax opened this issue · 2 comments
zhuangmax commented
- 当前歌词调大,比如22f,其他歌词调小,比如16f
- 如果改了1,会发现歌词绘制的一个bug,直接 canvas.translate(paddingLeft.toFloat(), rowY) 就可以了,否则行距显示有误
- 另外建议可以参考其他商业软件调整一下歌词在浅色和深色主题下的配色
--- a/app/src/main/java/remix/myplayer/lyric/LrcView.kt
+++ b/app/src/main/java/remix/myplayer/lyric/LrcView.kt
@@ -170,10 +170,12 @@ class LrcView : View, ILrcView {
override fun init() {
paintForHighLightLrc.isAntiAlias = true
paintForHighLightLrc.color = colorForHighLightLrc
- val size = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 15f,
+ val size = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 16f,
context.resources.displayMetrics)
+ val sizeHighlight = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 22f,
+ context.resources.displayMetrics)
- sizeForHighLightLrc = size
+ sizeForHighLightLrc = sizeHighlight
paintForHighLightLrc.textSize = sizeForHighLightLrc
paintForHighLightLrc.isFakeBoldText = true
@@ -269,7 +271,7 @@ class LrcView : View, ILrcView {
DEFAULT_SPACING_MULTI, 0f, true)
val extra = if (staticLayout.lineCount > 1) DensityUtil.dip2px(context, 10f) else 0
canvas.save()
- canvas.translate(paddingLeft.toFloat(), rowY - staticLayout.height / 2 + extra)
+ canvas.translate(paddingLeft.toFloat(), rowY)
staticLayout.draw(canvas)
canvas.restore()
rowY += staticLayout.height.toFloat()
zhuangmax commented
fork后自己定制了播放界面,用起来比较舒适,push了代码,截图和安装包,https://github.com/zhuangmax/APlayer
rRemix commented
好的,下版本我参考下