本文整理汇总了Java中android.widget.NumberPicker.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java NumberPicker.setVisibility方法的具体用法?Java NumberPicker.setVisibility怎么用?Java NumberPicker.setVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.NumberPicker
的用法示例。
在下文中一共展示了NumberPicker.setVisibility方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupMinutePicker
import android.widget.NumberPicker; //导入方法依赖的package包/类
/**
* Set the reference of minute picker, its digit format and register value change listener.
*
* @param pickerVisible if false, removes the spinner widget.
*/
@TargetApi(11)
protected void setupMinutePicker(boolean pickerVisible) {
mMinutePicker = (NumberPicker) findViewById(R.id.minute);
if (pickerVisible) {
mMinutePicker.setMinValue(0);
mMinutePicker.setMaxValue(59);
mMinutePicker.setFormatter(TWO_DIGIT_FORMATTER);
mMinutePicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
@Override
public void onValueChange(NumberPicker spinner, int oldVal, int newVal) {
mCurrentMinute = newVal;
}
});
} else {
mMinutePicker.setVisibility(View.GONE);
findViewById(R.id.minute_divider).setVisibility(View.GONE);
}
}
示例2: setupHourPicker
import android.widget.NumberPicker; //导入方法依赖的package包/类
/**
* Set the reference of hour picker, its digit format and register value change listener.
*
* @param pickerVisible if false, removes the spinner widget.
*/
@TargetApi(11)
protected void setupHourPicker(boolean pickerVisible) {
mHourPicker = (NumberPicker) findViewById(R.id.hour);
if (pickerVisible) {
mHourPicker.setMinValue(0);
mHourPicker.setMaxValue(10);
mHourPicker.setFormatter(TWO_DIGIT_FORMATTER);
mHourPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
mCurrentHour = newVal;
}
});
} else {
mHourPicker.setVisibility(View.GONE);
findViewById(R.id.hour_divider).setVisibility(View.GONE);
}
}
示例3: setData
import android.widget.NumberPicker; //导入方法依赖的package包/类
public void setData(String[] areas, int selectedIndex, int level) {
if (level >= MAX_LEVEL) {
return;
}
int childCount = getChildCount();
for (int i = childCount - 1; i >= level; i--) {
getChildAt(i).setVisibility(View.GONE);
}
if (areas == null || areas.length == 0) {
return;
}
NumberPicker picker = allNumberPickers[level];
if (picker == null) {
picker = createNumberPicker(areas, level);
allNumberPickers[level] = picker;
addView(picker);
} else {
picker.setVisibility(View.VISIBLE);
picker.setDisplayedValues(null);
picker.setMinValue(0);
picker.setMaxValue(areas.length - 1);
picker.setDisplayedValues(areas);
}
picker.setValue(selectedIndex);
picker.setEnabled(true);
areaChangeListener.onAreaChange(level, selectedIndex);
}