# VNTNumberPickerPreference **Repository Path**: chinasoft4_ohos/VNTNumberPickerPreference ## Basic Information - **Project Name**: VNTNumberPickerPreference - **Description**: 这是一个易于使用的自定义首选项,它将打开一个带有数字选择器的对话框。该值将自动保存,您可以在XML中方便地设置default-,min-和maxValue。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2021-06-18 - **Last Updated**: 2021-09-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # VNTNumberPickerPreference #### 项目介绍 - 项目名称:VNTNumberPickerPreference - 所属系列:openharmony的第三方组件适配移植 - 功能:实现VNTNumberPickerPreference数字选择器值自动保存 - 项目移植状态:主功能完成 - 调用差异:无 - 开发版本:sdk6,DevEco Studio 2.2 Beta1 - 基线版本: Release 1.0.0 #### 效果演示 #### 安装教程 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:vntNumber_PickerPre:1.0.1') ...... } ``` 在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 #### 使用说明 在点击事件中初始化弹窗布局 parameterEntity.setKey(Constants.FONT_SIZE); parameterEntity.setMinValue(8); parameterEntity.setMaxValue(100); parameterEntity.setWheelModeEnabled(true); parameterEntity.setValue(fontContent.getText()); parameterEntity.setTitle(fontTitle.getText()); new XPopup.Builder(getContext()) .popupAnimation(PopupAnimation.NoAnimation) .setPopupCallback(new SimpleCallback() { @Override public void onDismiss(BasePopupView basePopupView) { // 完全隐藏的时候执行 fontContent.setText(PreferenceUtils.getString(getApplicationContext(), Constants.FONT_SIZE, "25")); } }) .asCustom(new CustomPickerPopup(parameterEntity)) .show(); ParameterEntity为实体类 设置Preferences存储key parameterEntity.setKey(Constants.FONT_SIZE); 设置最小值 parameterEntity.setMinValue(8); 设置最大值 parameterEntity.setMaxValue(8); 设置是否可以循环滚动 parameterEntity.setWheelModeEnabled(true); 设置当前Value值 parameterEntity.setValue(fontContent.getText()); 设置Title值 parameterEntity.setTitle(fontTitle.getText()); 获取字体大小 PreferenceUtils.getString(getApplicationContext(), Constants.FONT_SIZE, "25") #### 测试信息 CodeCheck代码测试无异常 CloudTest代码测试无异常 病毒安全检测通过 当前版本demo功能与原组件基本无差异 #### 版本迭代 - 1.0.1 #### 版权和许可信息 ``` Copyright (C) 2014-2016 Vanniktech - Niklas Baudy Licensed under the Apache License, Version 2.0 ```