名稱 | OpenDanmaku |
---|---|
語(yǔ)言 | Android |
平臺(tái) | GitOSC |
作者 | linsea |
鏈接 | 點(diǎn)此進(jìn)入 |
備注 | 更多精彩開源庫(kù)推薦請(qǐng)?jiān)L問明燈小站 |
今天推薦的是一款安卓的彈幕控件舅柜,支持設(shè)置彈幕開始Y軸的偏移量瞒窒、彈幕結(jié)束Y軸的偏移量、最大行數(shù)恋技、最大可見行數(shù)拇舀、彈幕時(shí)間間隔等自定義屬性。
效果圖
效果圖
使用方法
- 添加依賴
dependencies {
compile 'com.linsea:opendanmaku:1.0.0@aar'
}
- 添加布局控件
<com.opendanmaku.DanmakuView
android:id="@+id/danmakuView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
app:start_Y_offset="0.2"
app:end_Y_offset="0.8"
app:max_row="4"
app:max_running_per_row="2"
app:pick_interval="1000"
app:show_debug="false" />
- 在Activity添加如下代碼
mDanmakuView = (DanmakuView) findViewById(R.id.danmakuView);
// 添加彈幕項(xiàng)
mDanmakuView.addItem(list, true);
mDanmakuView.addItem(new DanmakuItem(this, "Hello World", mDanmakuView.getWidth());
//開始顯示
mDanmakuView.show();
//隱藏
mDanmakuView.hide();
//清屏
mDanmakuView.clear();
更多使用方法請(qǐng)參考其GitOSC蜻底。