跳转到内容
搜索文档

RtkControlBarButton

最后更新 查看 MarkdownAgent 设置

一个骨架组件,用于构建自定义控制栏按钮。

属性

属性 类型 是否必填 默认值 描述
rtk_cbb_icon reference - 按钮图标的 Drawable 资源
rtk_cbb_variant button | horizontal button 布局变体
rtk_cbb_showText boolean true 是否显示标签文本
rtk_cbb_iconSize dimension - 图标大小
rtk_cbb_iconPadding dimension - 图标和标签之间的间距

方法

方法 参数 描述
applyDesignTokens designTokens: RtkDesignTokens 应用自定义设计标记(design tokens)进行主题化设置
setIconDrawable drawable: Drawable? 设置按钮图标
setIconTint color: Int 设置图标着色(tint)
setText text: String? 设置按钮标签文本
setProcessingState processing: Boolean 显示或隐藏加载指示器

使用示例

基本用法

<com.cloudflare.realtimekit.ui.view.controlbarbuttons.RtkControlBarButton
    android:id="@+id/rtk_control_bar_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:rtk_cbb_showText="true"
    app:rtk_cbb_variant="button" />

结合方法使用

val buttonView = findViewById<RtkControlBarButton>(R.id.rtk_control_bar_button)
buttonView.setOnClickListener { }

这篇文档对您有帮助吗?