不喜欢流派 - 通用音乐播放器 [英] Not Getting Thumb with Genres - Universal Music Player
问题描述
我正在使用 Google 提供的 UMP
示例,我没有对代码进行任何更改,即使我没有尝试任何开箱即用的东西,我只是将您的项目导入我的工作空间并在我的设备上检查它,发现我没有获得带有流派的拇指
(按流派分类的歌曲)和流派列表...
I am using UMP
example provided by Google, I have not made any change in my code, even I have not tried anything out of the box, I just imported your project into my work-space and checked it on my device, and found that I am not getting Thumb with Genres
(Songs by genre) and List of Genres...
虽然我应该从我们的 JSON 中获取 Thumb,但这是我尝试过的(但没有成功)-
Whereas I supposed to get Thumb from our JSON, here is what I have tried (but no success) -
holder.mImageView.setImageBitmap(description.getIconBitmap());
更新 # 1 根据@NageshSusarla 的建议 此处
UPDATE # 1 AS PER SUGGESTED BY @NageshSusarla here
holder.mTitleView.setText(description.getTitle());
holder.mDescriptionView.setText(description.getSubtitle());
AlbumArtCache cache = AlbumArtCache.getInstance();
Bitmap art = cache.getIconImage(url);
if (art == null) {
cache.fetch(url, new AlbumArtCache.FetchListener() {
@Override
public void onFetched(String artUrl, Bitmap bitmap, Bitmap icon) {
if (artUrl.equals(url)) {
holder.mImageView.setImageBitmap(icon);
}
}
});
} else {
holder.mImageView.setImageBitmap(bitmap);
}
holder.mImageView.setImageBitmap(description.getIconBitmap());
并得到无法解析符号'url'
推荐答案
- 可能尚未设置图标位图.最好使用AlbumartCache 来获取图标,然后将其设置在imageView 上.要传递给
AlbumArtCache.getInstance().fetch(url,..)
的 url 是description.getIconUri().toString()
- 您可能在 uAmp 中看不到它的原因是它应用了色调.您可以从 media_list_item.xml 中删除色调以尝试更改.
旁白:这确实是设计使然,图标仅在用户选择要播放的项目时才会显示在底部.
Aside: This is indeed by design and the icon is only shown at the bottom when a user selects the item to be played.
这篇关于不喜欢流派 - 通用音乐播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!