当前位置:网站首页>Function and usage of numberpick
Function and usage of numberpick
2022-07-07 17:36:00 【XLMN】
Numberpick The function and usage of
Value selector , It is used for users to enter values , You can enter values through the keyboard , You can also drag to select values
public class MainActivity extends Activity {
NumberPicker np1, np2;
// Define the minimum value , Initial value of maximum value
int minfraction = 140, maxfraction = 150;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.numberpicket);
np1 = findViewById(R.id.numberpicket);
np1.setMaxValue(150);
np1.setMinValue(140);
// Set up np1 The current value of the
np1.setValue(minfraction);
// Add listener
np1.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
// When numberPICKET When things change , Will stimulate the method
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
minfraction = newVal;
showSelectedPrice();
}
});
np2 = findViewById(R.id.numberpicket01);
np2.setMinValue(145);
np2.setMaxValue(150);
// set currency
np2.setValue(maxfraction);
// Add listener
np2.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
minfraction = newVal;
showSelectedPrice();
}
});
}
private void showSelectedPrice() {
Toast.makeText(this, " Your lowest score in a single subject is " + minfraction + " Your highest score in a single subject is " + maxfraction, Toast.LENGTH_LONG).show();
}
}
<?xml version="1.0" encoding="utf-8"?><TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="120dp"
android:layout_height="wrap_content"
android:text=" Minimum score of single subject " />
<NumberPicker
android:id="@+id/numberpicket"
android:layout_width="match_parent"
android:layout_height="150dp"
android:focusable="true"
android:focusableInTouchMode="true" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="120dp"
android:layout_height="wrap_content"
android:text=" The maximum score of a single subject "></TextView>
<NumberPicker
android:id="@+id/numberpicket01"
android:layout_width="match_parent"
android:layout_height="150dp"
android:focusable="true"
android:focusableInTouchMode="true" />
</TableRow>
边栏推荐
- Mysql 索引命中级别分析
- 麒麟信安云平台全新升级!
- Leetcode brush questions day49
- 百度地图自定义样式向右拖拽导致全球地图经度0度无法正常显示
- Skimage learning (3) -- adapt the gray filter to RGB images, separate colors by immunohistochemical staining, and filter the maximum value of the region
- 第3章业务功能开发(用户登录)
- mysql使用笔记一
- 到底有多二(Lua)
- redis主从、哨兵主备切换搭建一步一步图解实现
- 鲲鹏开发者峰会2022 | 麒麟信安携手鲲鹏共筑计算产业新生态
猜你喜欢
How to choose the appropriate automated testing tools?
麒麟信安加入宁夏商用密码协会
第3章业务功能开发(安全退出)
What is cloud computing?
麒麟信安操作系统衍生产品解决方案 | 存储多路径管理系统,有效提高数据传输可靠性
状态模式 - Unity(有限状态机)
PLC: automatically correct the data set noise, wash the data set | ICLR 2021 spotlight
自定义View必备知识,Android研发岗必问30+道高级面试题
第3章业务功能开发(用户访问项目)
The top of slashdata developer tool is up to you!!!
随机推荐
[video / audio data processing] Shanghai daoning brings you elecard download, trial and tutorial
第3章业务功能开发(用户登录)
LeetCode 890(C#)
使用 xml资源文件定义菜单
【网络攻防原理与技术】第4章:网络扫描技术
Rpcms method of obtaining articles under the specified classification
Is AI more fair than people in the distribution of wealth? Research on multiplayer game from deepmind
LeetCode 497(C#)
centos7安装mysql笔记
大笨钟(Lua)
Nerf: the ultimate replacement for deepfake?
本周小贴士#134:make_unique与私有构造函数
viewflipper的功能和用法
【网络攻防原理与技术】第5章:拒绝服务攻击
On Apache Doris Fe processing query SQL source code analysis
鲲鹏开发者峰会2022 | 麒麟信安携手鲲鹏共筑计算产业新生态
SIGGRAPH 2022最佳技术论文奖重磅出炉!北大陈宝权团队获荣誉提名
The computer cannot add a domain, and the Ping domain name is displayed as the public IP. What is the problem? How to solve it?
Matplotlib绘制三维图形
Siggraph 2022 best technical paper award comes out! Chen Baoquan team of Peking University was nominated for honorary nomination