【发布时间】:2015-08-14 09:24:58
【问题描述】:
不确定这里有多少人熟悉Android Universal Music Player,但我在MediaItemViewHolder.java 文件中显示专辑时遇到了问题。
所以这是我修改后的基本结构:
// image view for the album cover
holder.mImageView = (ImageView) convertView.findViewById(R.id.play_eq);
// get the album art url
String artUrl = description.getIconUri().toString();
Bitmap art;
AlbumArtCache cache = AlbumArtCache.getInstance();
art = cache.getIconImage(artUrl);
....
if (cachedState == null || cachedState != state) {
switch (state) {
case STATE_PLAYABLE:
// display the album cover
holder.mImageView.setImageBitmap(art);
break;
....
这会正确显示专辑封面。但是,它最初是空白的。一旦用户点击一个项目,图像就会显示出来。
屏幕截图#1:一旦应用程序加载并且用户没有点击任何项目:
屏幕截图#2:一旦用户点击该项目即可播放歌曲
我不确定是什么导致专辑最初是空白的。查看AlbumArtCache.java 我看不到任何可能导致此问题的有关 OnClickListener 的限制。
有什么建议可以解决这个问题吗?
【问题讨论】:
标签: java android android-imageview android-bitmap