# BGATransformersTip-Ohos
**Repository Path**: chinasoft2_ohos/BGATransformersTip-ohos
## Basic Information
- **Project Name**: BGATransformersTip-Ohos
- **Description**: 实现浮窗展示在锚点控件的任意位置,支持配置浮窗背景色,支持配置指示箭头(是否展示、展示在浮窗的任意位置、高度、圆角、颜色)
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 1
- **Created**: 2021-05-07
- **Last Updated**: 2024-06-07
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# BGATransformersTip-Ohos
#### 项目介绍
- 项目名称:利用PopupDialog实现自定义的弹出悬浮框
- 所属系列:openharmony的第三方组件适配移植
- 功能:实现浮窗展示在锚点控件的任意位置,支持配置浮窗背景色,支持配置指示箭头(是否展示、展示在浮窗的任意位置、高度、圆角、颜色)。
- 项目移植状态:主功能完成
- 调用差异:无
- 开发版本:sdk6,DevEco Studio 2.2 Beta1
- 基线版本:Release 1.0.8
#### 效果演示
#### 安装教程
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:BGATransformersTip_ohos:1.0.0')
......
}
```
在sdk6,DevEco Studio 2.2 Beta下项目可直接运行
如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,
并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
#### 使用说明
1、添加浮窗布局文件
```
```
2、设置浮窗背景、箭头位置、大小等。
```
TransformersTip transformersTip = new TransformersTip(anchorView, component) {
@Override
public boolean isTouchOutside() {
return false;
}
@Override
protected void initView(Component contentView) {
// 点击浮窗中自定按钮关闭浮窗
contentView.findComponentById(ResourceTable.Id_tv_tip_close)
.setClickedListener(new Component.ClickedListener() {
@Override
public void onClick(Component component) {
dismissTip();
}
});
}
};
transformersTip.setSize(WIDTH, HEIGHT);// 设置浮窗的位置大小
transformersTip.setMode(LayoutAlignment.TOP);// 设置箭头相对于浮窗的位置
transformersTip.setHasArrow(true);// 设置是否显示箭头
transformersTip.setCornerRadius(RADIUS);// 设置浮窗圆角半径
transformersTip.setAutoClosable(false);// 设置点击浮窗外部时是否自动关闭浮窗
transformersTip.setTransparent(false);//设置浮窗是否启用透明背景
transformersTip.setBackColor(color);// 设置浮窗背景色
transformersTip.setArrowSize(WIDTH_ARROW, HEIGHT_ARROW);// 设置箭头高度
transformersTip.showDialog();显示悬浮框
```
#### 测试信息
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件基本无差异
#### 版本迭代
- 1.0.0
#### 版权和许可信息
Copyright 2019 bingoogolapple
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.