bilibili / DanmakuFlameMaster

Android开源弹幕引擎·烈焰弹幕使 ~
http://app.bilibili.com/
Apache License 2.0
9.54k stars 2.1k forks source link

关于弹幕加载html标签格式 #408

Open Mrluosheng opened 5 years ago

Mrluosheng commented 5 years ago

问下这种Html标签格式的怎么弹幕怎么加载出来:

luerheng commented 1 year ago

在项目里面有个UglyViewCacheStufferSampleActivity.java类,有段代码 mContext.setDanmakuStyle,下面有个布局文件layout_view_cache.xml 可以更改布局,并设置标签代码

luerheng commented 1 year ago

里面的图片展示可以用 viewHolder.mIcon.setImageBitmap(getBitmap(image_url));这个方法 , public static Bitmap getBitmap(String url) { Bitmap bm = null; try { URL iconUrl = new URL(url); URLConnection conn = iconUrl.openConnection(); HttpURLConnection http = (HttpURLConnection) conn; int length = http.getContentLength(); conn.connect(); // 获得图像的字符流 InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is, length); bm = BitmapFactory.decodeStream(bis); bis.close(); is.close();// 关闭流 } catch (Exception e) { e.printStackTrace(); } return bm; }