本文整理汇总了Java中android.widget.NumberPicker.setDescendantFocusability方法的典型用法代码示例。如果您正苦于以下问题:Java NumberPicker.setDescendantFocusability方法的具体用法?Java NumberPicker.setDescendantFocusability怎么用?Java NumberPicker.setDescendantFocusability使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.NumberPicker
的用法示例。
在下文中一共展示了NumberPicker.setDescendantFocusability方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initNumPicker
import android.widget.NumberPicker; //导入方法依赖的package包/类
/**
* 初始化传入的moneyPicker
*
* @param numberPickerArrayList 需要初始化的NumPicker
*/
private void initNumPicker(ArrayList<NumberPicker> numberPickerArrayList) {
Iterator iterator = numberPickerArrayList.iterator();
while (iterator.hasNext()) {
NumberPicker moneyPicker = (NumberPicker) iterator.next();
moneyPicker.setFormatter(this);
moneyPicker.setOnValueChangedListener(this);
moneyPicker.setOnScrollListener(this);
moneyPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
}
numberPickerArrayList.get(0).setMinValue(3);numberPickerArrayList.get(0).setMaxValue(15);//早餐的价格区间
numberPickerArrayList.get(1).setMinValue(5);numberPickerArrayList.get(1).setMaxValue(30);//午餐的价格区间
numberPickerArrayList.get(2).setMinValue(5);numberPickerArrayList.get(2).setMaxValue(30);//晚餐的价格区间
numberPickerArrayList.get(0).setValue(preferences.getInt("moneyBreakfastChosen", 5));//早餐默认为5
numberPickerArrayList.get(1).setValue(preferences.getInt("moneyLunchChosen", 10));//午饭默认为10
numberPickerArrayList.get(2).setValue(preferences.getInt("moneyDinnerChosen", 12));//早餐默认为12
}
示例2: onViewCreated
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
//mConversationView = (ListView) view.findViewById(R.id.in);
mStartButton = (Button) view.findViewById(R.id.button_start);
mStopButton = (Button) view.findViewById(R.id.button_stop);
mDisconnectButton = (Button) view.findViewById(R.id.button_disconnect);
mLevel = (NumberPicker) view.findViewById(R.id.Level);
mLevel.setMaxValue(32);
mLevel.setMinValue(1);
mLevel.setValue(1);
mLevel.setWrapSelectorWheel(false);
mLevel.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
mSpeedText = (TextView) view.findViewById(R.id.Speed);
mPowerText = (TextView) view.findViewById(R.id.Power);
mRPMText = (TextView) view.findViewById(R.id.RPM);
mDistanceText = (TextView) view.findViewById(R.id.Distance);
mCaloriesText = (TextView) view.findViewById(R.id.Calories);
mHFText = (TextView) view.findViewById(R.id.Heart);
mTimeText = (TextView) view.findViewById(R.id.Time);
}
示例3: onCreate
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
controlToggle = (ToggleButton) findViewById(R.id.toggle_control);
mStatusTextView = (TextView) findViewById(R.id.tv_status);
mStatusTextView.setMovementMethod(new ScrollingMovementMethod());
mResultProgress = (ProgressBar) findViewById(R.id.progress);
mResultProgress.setMax(100);
NumberPicker picker = (NumberPicker) findViewById(R.id.number_picker);
picker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
picker.setOnValueChangedListener(this);
picker.setDisplayedValues(mSampleSizes);
picker.setMinValue(0);
picker.setMaxValue(mSampleSizes.length - 1);
picker.setWrapSelectorWheel(true);
picker.setValue(0);
mSampleSize = 1;
Logger.i("Sample size initial value: %s", mSampleSize);
checkPermissions();
}
示例4: bindView
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
public void bindView(Dialog dialog) {
textView = (TextView) dialog.findViewById(R.id.description);
numberPicker = (NumberPicker) dialog.findViewById(R.id.number_picker);
textView.setText(description);
numberPicker.setMaxValue(maxValue != null ? maxValue : 24);
numberPicker.setMinValue(minValue != null ? minValue : 1);
numberPicker.setOnLongPressUpdateInterval(100);
numberPicker.setWrapSelectorWheel(false);
if (currentValue != null) {
numberPicker.setValue(currentValue);
}
if (!canUseKeyBoard) {
numberPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
}
}
示例5: onBindDialogView
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected void onBindDialogView(View view) {
NumberPickerPreference preference = getNumberPickerPreference();
numberPicker = (NumberPicker) view.findViewById(R.id.numberpicker);
numberPicker.setMinValue(preference.getMinValue());
numberPicker.setMaxValue(preference.getMaxValue());
numberPicker.setValue(restoredState ? restoredValue : preference.getValue());
if (preference.getDescendantFocusability() > 0) {
//noinspection ResourceType
numberPicker.setDescendantFocusability(preference.getDescendantFocusability());
}
numberPicker.setWrapSelectorWheel(preference.isWrapSelectorWheel());
TextView textView = (TextView) view.findViewById(R.id.subtitle);
textView.setText(preference.getSubtitleText());
}
示例6: changePlayerCount
import android.widget.NumberPicker; //导入方法依赖的package包/类
@OnClick({R.id.player_count_value, R.id.player_count_description})
public void changePlayerCount() {
View numberPickerLayout = getLayoutInflater().inflate(R.layout.dialog_number_picker, null);
final NumberPicker numberPicker = (NumberPicker) numberPickerLayout.findViewById(R.id.number_picker);
numberPicker.setValue(Integer.valueOf(playerCountValue.getText().toString()));
numberPicker.setMinValue(2);
numberPicker.setMaxValue(100);
numberPicker.setWrapSelectorWheel(false);
numberPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
final TextView playersTextView = (TextView) numberPickerLayout.findViewById(R.id
.number_picker_text);
playersTextView.setText(R.string.activity_host_game_players_count_players);
new AlertDialog.Builder(this)
.setView(numberPickerLayout)
.setTitle(R.string.activity_host_game_players_count_title)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
playerCountValue.setText(String.valueOf(numberPicker.getValue()));
}
})
.setNegativeButton(android.R.string.cancel, null)
.show();
}
示例7: changePairsCount
import android.widget.NumberPicker; //导入方法依赖的package包/类
@OnClick({R.id.pairs_count_value, R.id.pairs_count_description})
public void changePairsCount() {
View numberPickerLayout = getLayoutInflater().inflate(R.layout.dialog_number_picker, null);
final NumberPicker numberPicker = (NumberPicker) numberPickerLayout.findViewById(R.id.number_picker);
Timber.d("setting value to " + Integer.valueOf(pairsCountValue.getText().toString()));
numberPicker.setMinValue(2);
numberPicker.setMaxValue(totalCardImages);
numberPicker.setValue(Integer.valueOf(pairsCountValue.getText().toString()));
numberPicker.setWrapSelectorWheel(false);
numberPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
final TextView pairsTextView = (TextView) numberPickerLayout.findViewById(R.id.number_picker_text);
pairsTextView.setText(R.string.activity_host_game_pairs_count_pairs);
new AlertDialog.Builder(this)
.setView(numberPickerLayout)
.setTitle(R.string.activity_host_game_pairs_count_title)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
pairsCountValue.setText(String.valueOf(numberPicker.getValue()));
}
})
.setNegativeButton(android.R.string.cancel, null)
.show();
}
示例8: onBindDialogView
import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected void onBindDialogView(View view) {
super.onBindDialogView(view);
TextView dialogMessageText = (TextView) view.findViewById(R.id.text_dialog_message);
dialogMessageText.setText(getDialogMessage());
mNumberPicker = (NumberPicker) view.findViewById(R.id.number_picker);
mNumberPicker.setMinValue(minValue);
mNumberPicker.setMaxValue(maxValue);
mNumberPicker.setValue(mValue);
mNumberPicker.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
}
示例9: initialize
import android.widget.NumberPicker; //导入方法依赖的package包/类
public void initialize(ListPreference timer, ListPreference beep) {
mTimer = timer;
mBeep = beep;
// Set title.
mTitle.setText(mTimer.getTitle());
// Duration
CharSequence[] entries = mTimer.getEntryValues();
mDurations = new String[entries.length];
Locale locale = getResources().getConfiguration().locale;
mDurations[0] = getResources().getString(R.string.setting_off); // Off
for (int i = 1; i < entries.length; i++)
mDurations[i] = String.format(locale, "%d", Integer.parseInt(entries[i].toString()));
int durationCount = mDurations.length;
mNumberSpinner = (NumberPicker) findViewById(R.id.duration);
mNumberSpinner.setMinValue(0);
mNumberSpinner.setMaxValue(durationCount - 1);
mNumberSpinner.setDisplayedValues(mDurations);
mNumberSpinner.setWrapSelectorWheel(false);
mNumberSpinner.setOnValueChangedListener(new OnValueChangeListener() {
@Override
public void onValueChange(NumberPicker picker, int oldValue, int newValue) {
setTimeSelectionEnabled(newValue != 0);
}
});
mConfirmButton = (Button) findViewById(R.id.timer_set_button);
mPickerTitle = findViewById(R.id.set_time_interval_title);
// Disable focus on the spinners to prevent keyboard from coming up
mNumberSpinner.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
mConfirmButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
updateInputState();
}
});
mTimerSound = (CheckBox) findViewById(R.id.sound_check_box);
mSoundTitle = findViewById(R.id.beep_title);
}
示例10: showNumberPicker
import android.widget.NumberPicker; //导入方法依赖的package包/类
private void showNumberPicker() {
mDialog = new Dialog(getActivity());
mDialog.setTitle(getResources().getString(
R.string.preferences_interface_homescreen_custom));
mDialog.setContentView(R.layout.custom_grid_size_dialog);
NumberPicker nPRows = (NumberPicker) mDialog.findViewById(R.id.custom_rows);
NumberPicker nPColumns = (NumberPicker) mDialog.findViewById(R.id.custom_columns);
InvariantDeviceProfile grid = getInvariantDeviceProfile();
int rows = grid.numRowsBase;
int columns = grid.numColumnsBase;
nPRows.setMinValue(Math.max(MIN_DYNAMIC_GRID_ROWS, rows - InvariantDeviceProfile.GRID_SIZE_MIN));
nPRows.setMaxValue(rows + InvariantDeviceProfile.GRID_SIZE_MAX);
nPRows.setValue(mCustomGridRows);
nPRows.setWrapSelectorWheel(false);
nPRows.setOnValueChangedListener(this);
nPRows.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
nPColumns.setMinValue(Math.max(MIN_DYNAMIC_GRID_COLUMNS,
columns - InvariantDeviceProfile.GRID_SIZE_MIN));
nPColumns.setMaxValue(columns + InvariantDeviceProfile.GRID_SIZE_MAX);
nPColumns.setValue(mCustomGridColumns);
nPColumns.setWrapSelectorWheel(false);
nPColumns.setOnValueChangedListener(this);
nPColumns.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
Button button = (Button) mDialog.findViewById(R.id.dialog_confirm_button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mDialog != null) {
mDialog.dismiss();
}
}
});
mDialog.setOnDismissListener(this);
mDialog.show();
}
示例11: initialize
import android.widget.NumberPicker; //导入方法依赖的package包/类
public void initialize(IconListPreference preference) {
mPreference = preference;
// Set title.
mTitle.setText(mPreference.getTitle());
// Duration
int durationCount = mDurations.length;
mNumberSpinner = (NumberPicker) findViewById(R.id.duration);
mNumberSpinner.setMinValue(0);
mNumberSpinner.setMaxValue(durationCount - 1);
mNumberSpinner.setDisplayedValues(mDurations);
mNumberSpinner.setWrapSelectorWheel(false);
// Units for duration (i.e. seconds, minutes, etc)
mUnitSpinner = (NumberPicker) findViewById(R.id.duration_unit);
mUnitSpinner.setMinValue(0);
mUnitSpinner.setMaxValue(mUnits.length - 1);
mUnitSpinner.setDisplayedValues(mUnits);
mUnitSpinner.setWrapSelectorWheel(false);
mTimePicker = findViewById(R.id.time_interval_picker);
mTimeLapseSwitch = (Switch) findViewById(R.id.time_lapse_switch);
mHelpText = (TextView) findViewById(R.id.set_time_interval_help_text);
mConfirmButton = (Button) findViewById(R.id.time_lapse_interval_set_button);
// Disable focus on the spinners to prevent keyboard from coming up
mNumberSpinner.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
mUnitSpinner.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
mTimeLapseSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
setTimeSelectionEnabled(isChecked);
}
});
mConfirmButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
updateInputState();
}
});
}