
回复
添加资源
添加资源将有机会获得更多曝光,你也可以直接关联已上传资源
去关联
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:RTextView:1.0.0')
......
}
在sdk6,DevEco Studio2.2 beta1下项目可直接运行
如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,
并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
开发者根据实际需要选择使用对应的功能属性
属性 | 说明 |
---|---|
corner_radius | 圆角 四周 |
corner_radius_top_left | 圆角 左上 |
corner_radius_top_right | 圆角 右上 |
corner_radius_bottom_left | 圆角 左下 |
corner_radius_bottom_right | 圆角 右下 |
border_dash_width | 虚线边框 宽度 |
border_dash_gap | 虚线边框 间隔 |
border_width_normal | 边框宽度 默认 |
border_width_pressed | 边框宽度 按下 |
border_width_unable | 边框宽度 不可点击 |
border_color_normal | 边框颜色 默认 |
border_color_pressed | 边框颜色 按下 |
border_color_unable | 边框颜色 不可点击 |
background_normal | 背景颜色 默认 |
background_pressed | 背景颜色 按下 |
background_unable | 背景颜色 不可点击 |
text_color_normal | 文字颜色 默认 |
text_color_pressed | 文字颜色 按下 |
text_color_unable | 文字颜色 不可点击 |
icon_src_normal | element icon 默认 |
icon_src_pressed | element icon 按下 |
icon_src_unable | element icon 不可点击 |
icon_height | element icon 高 |
icon_width | element icon 宽 |
icon_direction | element icon 位置{left,top,right,bottom} |
text_typeface | 字体样式 |
XML使用
<com.ruffian.library.RTextView
ohos:height="100vp"
ohos:width="100vp"
ohos:alignment="center"
ohos:text="文本控件"
//背景颜色 对应三个状态
rtv:background_normal="#3F51B5"
rtv:background_pressed="#FF450F21"
rtv:background_unable="#c3c3c3"
//边框颜色 对应三个状态
rtv:border_color_normal="#FF4081"
rtv:border_color_pressed="#3F51B5"
rtv:border_color_unable="#c3c3c3"
//边框宽度 对应三个状态 一般设置相同值
rtv:border_width_normal="3vp"
rtv:border_width_pressed="4vp"
rtv:border_width_unable="5vp"
//虚线边框 1.虚线边框宽度 2.虚线间隔
rtv:border_dash_width="10vp"
rtv:border_dash_gap="4vp"
//圆角度数 1.四周统一值 2.四个方向各个值
//xml: 通过xml 设置了 corner_radius ,则 corner_radius_xxx 不起作用
//java: 通过java代码设置 corner_radius_xxx ,则 corner_radius 不起作用
rtv:corner_radius="10vp"
rtv:corner_radius_top_left="10vp"
rtv:corner_radius_bottom_left="15vp"
rtv:corner_radius_bottom_right="20vp"
rtv:corner_radius_top_right="25vp"
//drawableXXX icon 对应三个状态
rtv:icon_src_normal="@mipmap/icon_phone_normal"
rtv:icon_src_pressed="@mipmap/icon_phone_pressed"
rtv:icon_src_unable="@mipmap/icon_phone_unable"
//drawableXXX icon 方向 {上,下,左,右}
rtv:icon_direction="top"
//drawableXXX icon 宽/高
rtv:icon_height="30vp"
rtv:icon_width="30vp"
//文字颜色 对应三个状态
rtv:text_color_normal="#c3c3c3"
rtv:text_color_pressed="#3F51B5"
rtv:text_color_unable="#FF4081"
//字体样式
rtv:text_typeface="fonts/RobotoMono-Thin.ttf"
/>
以上属性均提供Java代码 get/set 方法
备注
1. 圆角边框,圆角背景等属性需要配合 `background_xxx` 自定义背景属性使用,原生 `background` 没有效果
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件基本无差异
MIT License
Copyright (c) 2018 Ruffian-痞子
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.