礼物选择面板组件 (GiftListPanelView) 展示了后台配置的礼物列表。用户可以点击礼物,将其发送到直播间,并由礼物播放器组件进行播放,从而增强直播互动性。
效果展示

说明:
组件接入
组件使用
礼物面板组件需要直播间信息,因此必须在观众成功进入直播间或主播创建直播间后才能使用。
初始化组件
创建
GiftListPanelView
实例并将其添加到您的视图上。您还需要实现 OnSendGiftListener
,以便在用户点击发送礼物时获取回调信息。说明:
此操作必须在进房成功的回调中执行。
GiftListPanelView giftListPanelView = new GiftListPanelView(getContext());giftListPanelView.init("roomId");giftListPanelView.setListener(new GiftListPanelView.OnSendGiftListener() {@Overridepublic void onSendGift(GiftListPanelView view, Gift gift, int giftCount) {}});giftListPanelView.sendGift(new Gift(), 1, new GiftUser());
自定义礼物面板
如果您需要自定义礼物面板的礼物列表,可以在初始化后通过
setGiftList
方法进行设置。GiftListPanelView giftListPanelView = new GiftListPanelView(getContext());giftListPanelView.setGiftList(giftList);