# MaterialBadgeTextView
**Repository Path**: HarmonyOS-tpc/MaterialBadgeTextView
## Basic Information
- **Project Name**: MaterialBadgeTextView
- **Description**: 一个为Badge提供了改进的textview的库。Badge是带有插入数字的彩色圆圈,该圆圈显示在图标的右上角,通常在IM应用程序中显示新消息或新功能的作用。
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 1
- **Created**: 2021-04-01
- **Last Updated**: 2024-11-22
## Categories & Tags
**Categories**: harmony
**Tags**: None
## README
# MaterialBadgeTextView
一个为Badge提供了改进的textview的库。Badge是带有插入数字的彩色圆圈,该圆圈显示在图标的右上角,通常在IM应用程序中显示新消息或新功能的作用。
## 特征
1. 易于使用-您可以将其用作普通TextView
2. 封装MenuItemBadge
## Usage
```xml
```
其中ohos:background="#EF4738FF"设置MaterialBadgeTextView的背景色,其他属性和Text一样设置,默认背景色时"#999999FF",当text不设置或者setText(""),MaterialBadgeTextView不显示
```xml
```
其中ohos:txt_bg_color:设置MaterialBadgeTextView的背景色
ohos:txt_color:设置MaterialBadgeTextView的文字颜色
ohos:img_res_id:设置MenuItemBadge的图标
```java
menuNotification.setHighLightMode();//只显示MenuItemBadge右上角有红点
menuMessage.clearHighLightMode();//清除MenuItemBadge右上角红点及文字
menuMessage.setBadgeCount("999");//"**"是数值型字符串显示角标数字(0~99及99+),不是数值型,显示设置的文字
menuMessage.setBadgeCount(999);//设置MenuItemBadge角标数字
```
详情见sample
## entry运行要求
通过DevEco studio,并下载openharmonySDK
将项目中的build.gradle文件中dependencies→classpath版本改为对应的版本(即您当前IDE新建项目中所用的版本)
## 集成
allprojects{
repositories{
mavenCentral()
}
}
implementation 'io.openharmony.tpc.thirdlib:MaterialBadgeTextView:1.0.3'
# License
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.