本文整理匯總了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);
}