當前位置: 首頁>>代碼示例>>Java>>正文


Java NumberPicker.setVisibility方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:ChessCom,項目名稱:android-chessclock,代碼行數:24,代碼來源:TimePickerView.java

示例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);
    }
}
 
開發者ID:ChessCom,項目名稱:android-chessclock,代碼行數:25,代碼來源:TimePickerView.java

示例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);
}
 
開發者ID:LyndonChin,項目名稱:AndroidAreaPicker,代碼行數:32,代碼來源:AreaPicker.java


注:本文中的android.widget.NumberPicker.setVisibility方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。