当前位置: 首页>>代码示例>>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;未经允许,请勿转载。