说明:
SDK 支持高度自定义课堂内的 UI(如头部导航栏、消息气泡等)。以下以自定义头部左侧组件为例。
1. 创建自定义 View (Java 示例)
实现
NativeViewCreator 接口,编写您的原生 Android View:public class HeaderLeftViewCreator implements NativeViewCreator {@Overridepublic View createView(Context context, int id, Object args) {// 创建一个水平布局LinearLayout layout = new LinearLayout(context);layout.setOrientation(LinearLayout.HORIZONTAL);layout.setGravity(Gravity.CENTER_VERTICAL);// 添加自定义文字TextView textView = new TextView(context);textView.setText("自定义头部");textView.setTextColor(Color.WHITE);layout.addView(textView);// 添加自定义图标ImageView infoIcon = new ImageView(context);infoIcon.setImageResource(android.R.drawable.ic_menu_info_details);layout.addView(infoIcon);return layout;}@Overridepublic void disposeView(View view) {// 页面销毁时的资源清理工作}}
2. 将自定义 View 注册到配置中
在进房前,将写好的 Creator 赋值给
TCICConfig:// 1. 实例化头部配置val headerConfig = TCICHeaderComponentConfig()// 2. 绑定自定义 ViewheaderConfig.setHeaderLeftBuilder(::HeaderLeftViewCreator)// 3. 写入全局配置并进房val config = TCICConfig(token, classId, userId, role)config.headerComponentConfig = headerConfigTCICManager.setConfig(config)context.startActivity(TCICManager.getTCICIntent(context))
附:支持自定义的组件列表
您可以根据业务需求,对以下模块进行自定义替换:
头部组件 (
TCICHeaderComponentConfig):左侧视图、中间视图、右侧视图、操作按钮。消息组件 (
TCICMessageComponentConfig):消息列表头部、消息气泡、单条消息 Item。音视频组件 (
TCICVideoComponentConfig):视频操作栏、悬浮视频窗口。