欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android EasyBarrage實(shí)現(xiàn)輕量級(jí)彈幕效果

 更新時(shí)間:2017年08月03日 16:01:52   作者:Knight_Davion  
本篇文章主要介紹了Android EasyBarrage實(shí)現(xiàn)輕量級(jí)彈幕效果,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧

本文介紹了Android EasyBarrage實(shí)現(xiàn)輕量級(jí)彈幕效果,分享給大家,具體如下:

概述

EasyBarrage是Android平臺(tái)的一種輕量級(jí)彈幕效果目前支持以下設(shè)置:

  1. 自定義字體顏色,支持隨機(jī)顏色;
  2. 自定義字體大小,支持隨機(jī)字體大?。?/li>
  3. 支持邊框顯示,用于區(qū)分自己的彈幕和其他彈幕;
  4. 自定義邊框顏色;
  5. 彈幕數(shù)據(jù)是否允許重復(fù);
  6. 自定義單屏顯示的最大彈幕數(shù)量;
  7. 數(shù)據(jù)不重疊;
  8. 支持動(dòng)態(tài)添加彈幕;
  9. 不依賴(lài)VideoView,數(shù)據(jù)自動(dòng)循環(huán)顯示。

github:https://github.com/shiweibsw/EasyBarrage

顯示效果

橫屏

豎屏

使用

1 build.gradle

compile 'com.kd.easybarrage:library:0.0.1'

2 xml

 <com.kd.easybarrage.BarrageView
  android:id="@+id/barrageView"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:layout_above="@+id/send"
  app:allow_repeat="true"
  app:border_color="@color/colorAccent"
  app:line_height="20dp"
  app:max_text_size="20"
  app:min_text_size="14"
  app:random_color="true"
  app:size="200"/>

屬性說(shuō)明

屬性 說(shuō)明
max_text_size 最大字體
min_text_size 最小字體
size 單屏最大彈幕數(shù)量
line_height 行高
border_color 邊框彈幕的邊框顏色
random_color 是否啟用隨機(jī)顏色
allow_repeat 彈幕內(nèi)容是否可重復(fù)

3 Java代碼

添加彈幕數(shù)據(jù)

for (int i = 0; i < 200; i++) {
    mBarrages.add(new Barrage("彈幕數(shù)據(jù)" + i));
  }  

注意Barrage對(duì)象有多種構(gòu)造,可以設(shè)置字體顏色及是否顯示邊框,例如

3.1指定字體顏色

Barrage b=new Barrage("彈幕數(shù)據(jù)",R.color.colorAccent);

需要設(shè)置 app:random_color="false" 才有效

3.2顯示邊框

Barrage b=new Barrage("彈幕數(shù)據(jù)",true);

3.3指定顏色及顯示邊框

Barrage b=new Barrage("彈幕數(shù)據(jù)",R.color.colorAccent,true);

3.3只顯示內(nèi)容

Barrage b=new Barrage("彈幕數(shù)據(jù)");

添加一條彈幕

barrageView.addBarrage(new Barrage("我是新彈幕", true));

結(jié)束時(shí)調(diào)用destroy方法

barrageView.destroy();

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論