... | @@ -1206,3 +1206,59 @@ DWMediaPlayer player = new DWMediaPlayer(boolen force); |
... | @@ -1206,3 +1206,59 @@ DWMediaPlayer player = new DWMediaPlayer(boolen force); |
|
## 4.32 隐形跑马灯
|
|
## 4.32 隐形跑马灯
|
|
|
|
|
|
3.17.1版本支持
|
|
3.17.1版本支持
|
|
|
|
|
|
|
|
1.在gradle引入组件
|
|
|
|
|
|
|
|
```groovy
|
|
|
|
implementation 'com.bokecc.module:marquee:1.0.0'
|
|
|
|
```
|
|
|
|
|
|
|
|
2.在xml文件中需要添加对应的布局
|
|
|
|
|
|
|
|
示例:
|
|
|
|
|
|
|
|
```xml
|
|
|
|
<com.bokecc.marquee.TransparentMarquee
|
|
|
|
android:id="@+id/id_transparent_marquee"
|
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="match_parent"/>
|
|
|
|
```
|
|
|
|
|
|
|
|
3.根据开关来设置隐形跑马灯数据,设置数据的时机在鉴权监听器回调后
|
|
|
|
|
|
|
|
相关api:
|
|
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
|
| :------------------- | :----------------- |
|
|
|
|
| isInvisibleMarquee() | 是否开启透明跑马灯 |
|
|
|
|
|
|
|
|
```java
|
|
|
|
//设置鉴权监听器
|
|
|
|
player.setOnAuthMsgListener(new OnAuthMsgListener() {
|
|
|
|
@Override
|
|
|
|
public void onAuthMsg(final int enable, final int freetime, final String messaage, final MarqueeInfo marqueeInfo) {
|
|
|
|
runOnUiThread(new Runnable() {
|
|
|
|
|
|
|
|
@SuppressLint("DefaultLocale")
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
//如果开启了透明跑马灯,设置透明跑马灯样式以及内容
|
|
|
|
if (marqueeInfo!=null&&player.isInvisibleMarquee()){
|
|
|
|
transparentMarquee.setMarqueeAdapter(new TransparentMarqueeAdaper() {
|
|
|
|
//要展示的内容
|
|
|
|
@Override
|
|
|
|
public String onContent() {
|
|
|
|
return marqueeInfo.getTextBean().getContent();
|
|
|
|
}
|
|
|
|
//是否是深色系 默认是深色系
|
|
|
|
@Override
|
|
|
|
public boolean invisibleMarqueeLightMode() {
|
|
|
|
return super.invisibleMarqueeLightMode();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
``` |
|
|
|
\ No newline at end of file |