NumberPicker 使用小数方式去呈现 如何设置默认值为小数
private void openNumberPicker() {
Activity mActivity = MainActivity.this;
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
LayoutInflater inflater = mActivity.getLayoutInflater();
View rootView = inflater.inflate(R.layout.dialog_number_picker, null);
NumberPicker picker = (NumberPicker) rootView
.findViewById(id.number_picker);
picker.setMaxValue(100);
picker.setMinValue(30);
picker.setFormatter(new NumberPicker.Formatter() {
@Override
public String format(int value) {
return String.valueOf((float) value / 10);
}
});
builder.setView(rootView)
// Add action buttons
.setPositiveButton("确定", new DialogInte易做图ce.OnClickListener() {
@Override
public void onClick(DialogInte易做图ce dialog, int id) {
// sign in the user ...
}
})
.setNegativeButton("取消", new DialogInte易做图ce.OnClickListener() {
public void onClick(DialogInte易做图ce dialog, int id) {
}
}).setTitle("血压");
builder.show();
}
默认值无法设置为小数
补充:移动开发 , Android