# AutoSpannableTextView **Repository Path**: chinasoft4_ohos/AutoSpannableTextView ## Basic Information - **Project Name**: AutoSpannableTextView - **Description**: Support some of the key words can be clicked with the underline TextView - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 2 - **Created**: 2021-07-02 - **Last Updated**: 2022-09-06 ## Categories & Tags **Categories**: harmonyos-textview **Tags**: None ## README # AutoSpannableTextView ## 项目介绍 * 项目名称: AutoSpannableTextView * 所属系列:openharmony的第三方组件适配移植 * 功能:文字开头设置图片;关键字设置字体颜色,下划线,点击事件(因为api限制无法设置背景颜色,点击关键字背景改变功能没有实现) * 项目移植状态:主功能完成 * 调用差异:无 * 开发版本:sdk6,DevEco Studio 2.2 Beta1 * 基线版本:Release v1.0.1 ## 效果演示 ![cmd-markdown-logo](gif/1.gif) ## 安装教程 ### 安装教程 1.在项目根目录下的build.gradle文件中, ``` allprojects { repositories { maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' } } } ``` 2.在entry模块的build.gradle文件中, ``` dependencies { implementation('com.gitee.chinasoft_ohos:AutoSpannableTextView:1.0.0') ...... } ``` 在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 ## 使用说明 java UI方式: 1、在布局xml文件中声明 ```xml ``` 2、在ability中调用 ```java autoLinkStyleTextView.setOnClickCallBack(position -> { if(position==0){ ToastUtil.getInstance().showToast(this,"购买须知"); }else{ ToastUtil.getInstance().showToast(this,"用户条款"); } }); ``` 3、参数说明 | 参数 | 说明 | | --------------------------------- | ------------------------------------------------------------ | | autoLinkStyleTextViewTextValue | 需要样式的关键字,以逗号隔开 | | autoLinkStyleTextViewDefaultColor | 需要样式的关键字的颜色 | | autoLinkStyleTextViewHasUnderLine | 样式是否需下划线 | | autoLinkStyleTextViewType | 样式类型:开头图片和文本样式:start_image;文本样式:content_text | | autoLinkStyleTextViewStartImage | 文字开头加入图片 | js UI方式: 1、在hml中引入组件 ```xml
``` 2、参数说明 | 参数 | 说明 | | -------------- | ------------------------------------------------- | | buy_info | 购买须知文本 | | user_clause | 用户条款文本 | | activity_type | 样式类型:开头图片和文本样式:img;文本样式:text | | activity_title | 图片路径 | ## 测试信息 CodeCheck代码测试无异常 CloudTest代码测试无异常 病毒安全检测通过 当前版本demo功能与原组件基本无差异 ## 版本迭代 * 1.0.0