本文整理汇总了Java中android.widget.Spinner.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Spinner.setEnabled方法的具体用法?Java Spinner.setEnabled怎么用?Java Spinner.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.Spinner
的用法示例。
在下文中一共展示了Spinner.setEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onFinishInflate
import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected void onFinishInflate() {
super.onFinishInflate();
tvAmountA = (TextView) findViewById(R.id.tvAmountA);
tvAmountB = (TextView) findViewById(R.id.tvAmountB);
sCurrencyA = (Spinner) findViewById(R.id.sCurrencyA);
sCurrencyB = (Spinner) findViewById(R.id.sCurrencyB);
ArrayAdapter<String> btcAdapter = new ArrayAdapter<String>(getContext(),
android.R.layout.simple_spinner_item,
new String[]{"BTC"});
sCurrencyA.setAdapter(btcAdapter);
sCurrencyA.setEnabled(false);
ArrayAdapter<String> xmrAdapter = new ArrayAdapter<String>(getContext(),
android.R.layout.simple_spinner_item,
new String[]{"XMR"});
sCurrencyB.setAdapter(xmrAdapter);
sCurrencyB.setEnabled(false);
}
示例2: fillData
import android.widget.Spinner; //导入方法依赖的package包/类
public void fillData(View view, int type, int selection) {
TGSelectableItem[] selectableItems = createDataValues(type);
ArrayAdapter<TGSelectableItem> adapter = new ArrayAdapter<TGSelectableItem>(getActivity(), android.R.layout.simple_spinner_item, selectableItems);
Spinner spinner = (Spinner) view.findViewById(R.id.harmonic_dlg_data_value);
spinner.setAdapter(adapter);
spinner.setEnabled(selectableItems.length > 0);
spinner.setVisibility(selectableItems.length > 0 ? View.VISIBLE : View.GONE);
if( selectableItems.length > 0 ) {
spinner.setSelection(adapter.getPosition(new TGSelectableItem(Integer.valueOf(selection), null)));
}
}
示例3: updateTuningValues
import android.widget.Spinner; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void updateTuningValues(View view, int spinnerId, int value, boolean enabled, int visibility) {
TGSelectableItem selection = new TGSelectableItem(Integer.valueOf(value), null);
Spinner spinner = (Spinner) view.findViewById(spinnerId);
spinner.setSelection(((ArrayAdapter<TGSelectableItem>)spinner.getAdapter()).getPosition(selection), false);
spinner.setVisibility(visibility);
spinner.setEnabled(enabled);
}
示例4: setUp
import android.widget.Spinner; //导入方法依赖的package包/类
/**
* This function sets up the dialog with the proper values. If the speedOff parameters
* has a -1 value disable both spinners
*
* @param color - the color to set
* @param speedOn - the flash time in ms
* @param speedOff - the flash length in ms
*/
private void setUp(int color, int speedOn, int speedOff, boolean onOffChangeable) {
mInflater = (LayoutInflater) getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = mInflater.inflate(R.layout.dialog_light_settings, null);
mColorPicker = (ColorPickerView) layout.findViewById(R.id.color_picker_view);
mColorPanel = (LinearLayout) layout.findViewById(R.id.color_panel_view);
mHexColorInput = (EditText) layout.findViewById(R.id.hex_color_input);
mNewColor = (ColorPanelView) layout.findViewById(R.id.color_panel);
mLightsDialogDivider = (View) layout.findViewById(R.id.lights_dialog_divider);
mPulseSpeedOn = (Spinner) layout.findViewById(R.id.on_spinner);
mPulseSpeedOff = (Spinner) layout.findViewById(R.id.off_spinner);
mColorPicker.setOnColorChangedListener(this);
mColorPicker.setColor(color, true);
mHexColorInput.setOnFocusChangeListener(this);
if (onOffChangeable) {
PulseSpeedAdapter pulseSpeedAdapter = new PulseSpeedAdapter(
R.array.notification_pulse_length_entries,
R.array.notification_pulse_length_values,
speedOn);
mPulseSpeedOn.setAdapter(pulseSpeedAdapter);
mPulseSpeedOn.setSelection(pulseSpeedAdapter.getTimePosition(speedOn));
mPulseSpeedOn.setOnItemSelectedListener(mPulseSelectionListener);
pulseSpeedAdapter = new PulseSpeedAdapter(R.array.notification_pulse_speed_entries,
R.array.notification_pulse_speed_values,
speedOff);
mPulseSpeedOff.setAdapter(pulseSpeedAdapter);
mPulseSpeedOff.setSelection(pulseSpeedAdapter.getTimePosition(speedOff));
mPulseSpeedOff.setOnItemSelectedListener(mPulseSelectionListener);
} else {
View speedSettingsGroup = layout.findViewById(R.id.speed_title_view);
speedSettingsGroup.setVisibility(View.GONE);
}
mPulseSpeedOn.setEnabled(onOffChangeable);
mPulseSpeedOff.setEnabled((speedOn != 1) && onOffChangeable);
setView(layout);
setTitle(R.string.edit_light_settings);
if (!getContext().getResources().getBoolean(
com.android.internal.R.bool.config_multiColorNotificationLed)) {
mColorPicker.setVisibility(View.GONE);
mColorPanel.setVisibility(View.GONE);
mLightsDialogDivider.setVisibility(View.GONE);
}
mReadyForLed = true;
updateLed();
}
示例5: updateOffset
import android.widget.Spinner; //导入方法依赖的package包/类
public void updateOffset(View view, boolean enabled) {
Spinner spinner = (Spinner) view.findViewById(R.id.track_tuning_dlg_offset_value);
spinner.setEnabled(enabled);
}