代码拉取完成,页面将自动刷新
该三方开源库从github fork过来,主要将底层接口调用的实现修改成鸿蒙接口的实现,将三方库鸿蒙化,供开发鸿蒙应用的开发者使用
fork地址:https://github.com/wangjiegulu/WheelView
fork版本号/日期:master / 2017/9/25
一个自定义的滚轮类控件,样式简洁
原项目Readme地址:https://github.com/wangjiegulu/WheelView/blob/master/README.md
项目移植状态:支持组件所有基本功能
完成度:100%
调用差异:无
导入方法
1.har导入
将har包放入lib文件夹并在build.gradle添加
implementation fileTree(dir: 'libs', include: ['*.har'])
2.Library引用
添加本工程中UcropLib模块到任意工程中,在需要使用的模块build.gradle中添加
implementation project(':library')
or
allprojects{
repositories{
mavenCentral()
}
}
implementation 'io.openharmony.tpc.thirdlib:WheelView:1.0.1'
使用方法 1 .在布局文件中添加以下代码
<com.wangjie.wheelview.WheelView
ohos:id="$+id:wv_main"
ohos:height="match_content"
ohos:width="match_parent"/>
2.在代码中初始化参数
//初始化控件
wheelView = (WheelView) findComponentById(ResourceTable.Id_wv_main);
//设置偏移
wheelView.setOffset(1);
//设置数据
wheelView.setItems(Arrays.asList(PLANETS));
//设置监听
wheelView.setOnWheelViewListener(new WheelView.OnWheelViewListener() {
@Override
public void onSelected(int selectedIndex, String item) {
LogUtil.info("MainAbilitySlice", "selectedIndex: " + selectedIndex + ", item: " + item);
}
});
//Dialog中使用
Component outerView = LayoutScatter.getInstance(getContext()).parse(ResourceTable.Layout_wheel_view, null, false);
WheelView wv = (WheelView) outerView.findComponentById(ResourceTable.Id_wv_main);
wv.setOffset(2);
wv.setItems(Arrays.asList(PLANETS));
wv.setSeletion(3);
wv.setOnWheelViewListener(new WheelView.OnWheelViewListener() {
@Override
public void onSelected(int selectedIndex, String item) {
LogUtil.info("MainAbilitySlice", "selectedIndex: " + selectedIndex + ", item: " + item);
}
});
commonDialog = new CommonDialog(getContext());
commonDialog.setTitleText("WheelView in Dialog")
.setContentCustomComponent(outerView)
.setAlignment(LayoutAlignment.CENTER)
.setSize(1000, 1000)
.show();
3.一些功能设置介绍
//设置wheelView的偏移
wheelView.setOffset();
//设置wheelView的监听
wheelView.setOnWheelViewListener();
//设置wheelView的选中位置
wheelView.setSeletion();
//设置wheelView的数据
wheelView.setItems();
//获取wheelView的偏移
wheelView.getOffset();
//获取wheelView的监听
wheelView.getOnWheelViewListener();
//获取wheelView的选中位置
wheelView.getSeletedIndex();
//获取选中位置的数据
wheelView.getSeletedItem();
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.```
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型