Java Code Examples for android.widget.ArrayAdapter#setDropDownViewResource()
The following examples show how to use
android.widget.ArrayAdapter#setDropDownViewResource() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SqlViewActivity.java From geopaparazzi with GNU General Public License v3.0 | 6 votes |
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sqlview); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); sqlSpinner = findViewById(R.id.sqlQuerySpinner); try { List<String> queriesNames = createQueries(); ArrayAdapter<String> queryAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, queriesNames); queryAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sqlSpinner.setAdapter(queryAdapter); sqlSpinner.setSelection(0); } catch (Exception e) { GPLog.error(this, null, e); //$NON-NLS-1$ } customQueryText = findViewById(R.id.ownQueryEditText); }
Example 2
Source File: SpinnersFragment.java From material with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_spinner, container, false); Spinner spn_label = (Spinner)v.findViewById(R.id.spinner_label); Spinner spn_no_arrow = (Spinner)v.findViewById(R.id.spinner_no_arrow); String[] items = new String[20]; for(int i = 0; i < items.length; i++) items[i] = "Item " + String.valueOf(i + 1); ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), R.layout.row_spn, items); adapter.setDropDownViewResource(R.layout.row_spn_dropdown); spn_label.setAdapter(adapter); spn_no_arrow.setAdapter(adapter); return v; }
Example 3
Source File: AutofillLocalCardEditor.java From delion with Apache License 2.0 | 6 votes |
void addSpinnerAdapters() { ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getActivity(), android.R.layout.simple_spinner_item); // Populate the month dropdown. Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_MONTH, 1); SimpleDateFormat formatter = new SimpleDateFormat("MMMM (MM)", Locale.getDefault()); for (int month = 0; month < 12; month++) { calendar.set(Calendar.MONTH, month); adapter.add(formatter.format(calendar.getTime())); } adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mExpirationMonth.setAdapter(adapter); // Populate the year dropdown. adapter = new ArrayAdapter<CharSequence>(getActivity(), android.R.layout.simple_spinner_item); int initialYear = calendar.get(Calendar.YEAR); for (int year = initialYear; year < initialYear + 10; year++) { adapter.add(Integer.toString(year)); } adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mExpirationYear.setAdapter(adapter); }
Example 4
Source File: AnyPathActivity.java From android-pdk with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_any_path); setTitle("Get Path.."); pathText = (EditText) findViewById(R.id.path_edittext); fieldsText = (EditText) findViewById(R.id.fields_edittext); responseView = (TextView) findViewById(R.id.path_response_view); responseView.setMovementMethod(new ScrollingMovementMethod()); getButton = (Button) findViewById(R.id.get_button); getButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onGet(); } }); spinner = (Spinner) findViewById(R.id.spinner); spinner.setOnItemSelectedListener(this); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.paths_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); }
Example 5
Source File: LogActivity.java From Forage with Mozilla Public License 2.0 | 5 votes |
@Override public void setLogTypes(@ArrayRes int options) { ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, options, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item); logType.setAdapter(adapter); }
Example 6
Source File: WifiConfigCreationDialog.java From android-testdpc with Apache License 2.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); View dialogView = inflater.inflate(R.layout.wifi_config_dialog, null); mPasswordView = dialogView.findViewById(R.id.password_layout); mSsidText = (EditText) dialogView.findViewById(R.id.ssid); mSsidText.addTextChangedListener(this); mPasswordText = (EditText) dialogView.findViewById(R.id.password); mPasswordText.addTextChangedListener(this); mSecurityChoicesSpinner = (Spinner) dialogView.findViewById(R.id.security); mSecurityChoicesSpinner.setOnItemSelectedListener(this); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.wifi_security_choices, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mSecurityChoicesSpinner.setAdapter(adapter); initialize(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) .setTitle(R.string.add_network) .setView(dialogView) // Listener for save button will be set in onStart(). .setPositiveButton(R.string.wifi_save, null) .setNegativeButton(R.string.wifi_cancel, null); return builder.create(); }
Example 7
Source File: loginActivity.java From android-sqrl with GNU General Public License v3.0 | 5 votes |
public void addUsersToSpinner() { users.add("User 1"); users.add("User 2"); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, users); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); username.setAdapter(dataAdapter); }
Example 8
Source File: LivePreviewActivity.java From quickstart-android with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate"); binding = ActivityLivePreviewBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); List<String> options = new ArrayList<>(); options.add(FACE_CONTOUR); options.add(FACE_DETECTION); options.add(AUTOML_IMAGE_LABELING); options.add(OBJECT_DETECTION); options.add(TEXT_DETECTION); options.add(BARCODE_DETECTION); options.add(IMAGE_LABEL_DETECTION); options.add(CLASSIFICATION_QUANT); options.add(CLASSIFICATION_FLOAT); // Creating adapter for spinner ArrayAdapter<String> dataAdapter = new ArrayAdapter<>(this, R.layout.spinner_style, options); // Drop down layout style - list view with radio button dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // attaching data adapter to spinner binding.spinner.setAdapter(dataAdapter); binding.spinner.setOnItemSelectedListener(this); binding.facingSwitch.setOnCheckedChangeListener(this); // Hide the toggle button if there is only 1 camera if (Camera.getNumberOfCameras() == 1) { binding.facingSwitch.setVisibility(View.GONE); } if (allPermissionsGranted()) { createCameraSource(selectedModel); } else { getRuntimePermissions(); } }
Example 9
Source File: TGMeasureAddDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public void fillCount() { ArrayAdapter<TGSelectableItem> arrayAdapter = new ArrayAdapter<TGSelectableItem>(getActivity(), android.R.layout.simple_spinner_item, createCountValues()); arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); Spinner spinner = (Spinner) this.getView().findViewById(R.id.measure_add_dlg_count_value); spinner.setAdapter(arrayAdapter); spinner.setSelection(arrayAdapter.getPosition(new TGSelectableItem(Integer.valueOf(1), null))); }
Example 10
Source File: AuthenticatorActivity.java From kolabnotes-android with GNU Lesser General Public License v3.0 | 5 votes |
void initIntervallSpinner(){ String[] values = getResources().getStringArray(R.array.sync_intervall_types); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, R.layout.intervall_spinner_item, values); adapter.setDropDownViewResource(R.layout.intervall_spinner_item); mIntervallType.setAdapter(adapter); mIntervallType.setSelection(1); }
Example 11
Source File: ReconnectIntervalSetting.java From revolution-irc with GNU General Public License v3.0 | 5 votes |
public RuleViewHolder(View v, RulesAdapter adapter) { super(v); mAdapter = adapter; mReconnectDelaySpinner = v.findViewById(R.id.rule_duration_type); ArrayAdapter<CharSequence> spinnerAdapter = new ArrayAdapter<>(itemView.getContext(), R.layout.simple_spinner_item, android.R.id.text1, itemView.getResources().getStringArray(R.array.duration_types)); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mReconnectDelaySpinner.setAdapter(spinnerAdapter); mReconnectDelayText = v.findViewById(R.id.rule_interval); mRepeatCountText = v.findViewById(R.id.rule_repeat_times); View more = v.findViewById(R.id.rule_more); more.setOnClickListener((View view) -> { PopupMenu menu = new PopupMenu(view.getContext(), view, GravityCompat.END); MenuInflater inflater = menu.getMenuInflater(); inflater.inflate(R.menu.menu_reconnect_rule, menu.getMenu()); menu.setOnMenuItemClickListener((MenuItem item) -> { if (item.getItemId() == R.id.action_add) { mAdapter.mRules.add(getAdapterPosition() + 1, new Rule()); mAdapter.notifyItemInserted(getAdapterPosition() + 1); mAdapter.updateDialogOkButtonState(false); return true; } else if (item.getItemId() == R.id.action_delete) { if (mAdapter.mRules.size() > 1) { mAdapter.mRules.remove(getAdapterPosition()); mAdapter.notifyItemRemoved(getAdapterPosition()); mAdapter.updateDialogOkButtonState(true); } return true; } return false; }); menu.show(); }); }
Example 12
Source File: UserDictionaryAddWordFragment.java From Indic-Keyboard with Apache License 2.0 | 5 votes |
private void updateSpinner() { final ArrayList<LocaleRenderer> localesList = mContents.getLocalesList(getActivity()); final Spinner localeSpinner = (Spinner)mRootView.findViewById(R.id.user_dictionary_add_locale); final ArrayAdapter<LocaleRenderer> adapter = new ArrayAdapter<>( getActivity(), android.R.layout.simple_spinner_item, localesList); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); localeSpinner.setAdapter(adapter); localeSpinner.setOnItemSelectedListener(this); }
Example 13
Source File: TriggerListAdapter.java From AndroidAPS with GNU Affero General Public License v3.0 | 5 votes |
private Spinner createSpinner() { Spinner spinner = new Spinner(mContext); ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<>(mContext, R.layout.spinner_centered, TriggerConnector.Type.labels()); spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(spinnerArrayAdapter); return spinner; }
Example 14
Source File: MainActivity.java From discreet-app-rate with Apache License 2.0 | 5 votes |
private void manageViews() { buttonBar = (LinearLayout) findViewById(R.id.button_bar); okButton = (Button) findViewById(R.id.ok_button); currentCount = (TextView) findViewById(R.id.curent_count); hasBeenClicked = (TextView) findViewById(R.id.has_been_clicked); isElpased = (TextView) findViewById(R.id.is_elapsed); lastCrash = (TextView) findViewById(R.id.last_crash); monitoredTime = (TextView) findViewById(R.id.monitored_time); initialCount = (EditText) findViewById(R.id.initial_count); text = (EditText) findViewById(R.id.text); delay = (EditText) findViewById(R.id.delay); retryPolicy = (Spinner) findViewById(R.id.retry_policy); theme = (Spinner) findViewById(R.id.theme); actionSpinner = (Spinner) findViewById(R.id.action_chooser); installTime = (EditText) findViewById(R.id.install_time); pauseAfterCrash = (EditText) findViewById(R.id.pause_after_crash); minimumMonitoringTime = (EditText) findViewById(R.id.minimum_monitoring_time); minimumInterval = (EditText) findViewById(R.id.minimum_interval); onTop = (CheckBox) findViewById(R.id.on_top); useCustomView = (CheckBox) findViewById(R.id.use_custom_view); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.retry_policies, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); retryPolicy.setAdapter(adapter); ArrayAdapter<CharSequence> adapterTheme = ArrayAdapter.createFromResource(this, R.array.themes, android.R.layout.simple_spinner_item); adapterTheme.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); theme.setAdapter(adapterTheme); ArrayAdapter<CharSequence> actionAdapter = ArrayAdapter.createFromResource(this, R.array.actions, android.R.layout.simple_spinner_item); actionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); actionSpinner.setAdapter(actionAdapter); }
Example 15
Source File: ProfileSetting.java From XERUNG with Apache License 2.0 | 5 votes |
private void setBloodAdapter() { final String[] choices = {"A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"}; ArrayAdapter<String> badapter = new ArrayAdapter<String>(ProfileSetting.this, android.R.layout.simple_spinner_item, choices); badapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spBloodGroup.setAdapter(badapter); try { if (!bloodGroup.equals(null) && !bloodGroup.equals("0")) { int spinnerPosition = badapter.getPosition(bloodGroup); spBloodGroup.setSelection(spinnerPosition + 1); } } catch (Exception e) { // TODO: handle exception } }
Example 16
Source File: SuntimesConfigActivity0.java From SuntimesWidget with GNU General Public License v3.0 | 5 votes |
/** * @param context a context used to access resources */ protected void initTimeFormatMode(Context context) { if (spinner_timeFormatMode != null) { final ArrayAdapter<WidgetSettings.TimeFormatMode> spinner_timeFormatModeAdapter; spinner_timeFormatModeAdapter = new ArrayAdapter<WidgetSettings.TimeFormatMode>(this, R.layout.layout_listitem_oneline, WidgetSettings.TimeFormatMode.values()); spinner_timeFormatModeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner_timeFormatMode.setAdapter(spinner_timeFormatModeAdapter); } }
Example 17
Source File: WaypointProperties.java From Androzic with GNU General Public License v3.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Androzic application = Androzic.getApplication(); View rootView = inflater.inflate(R.layout.act_waypoint_properties, container, false); tabHost = (TabHost) rootView.findViewById(R.id.tabhost); tabHost.setup(); tabHost.addTab(tabHost.newTabSpec("main").setIndicator(getString(R.string.primary)).setContent(R.id.properties)); tabHost.addTab(tabHost.newTabSpec("advanced").setIndicator(getString(R.string.advanced)).setContent(R.id.advanced)); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { tabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 50; tabHost.getTabWidget().getChildAt(1).getLayoutParams().height = 50; } name = (TextView) rootView.findViewById(R.id.name_text); description = (TextView) rootView.findViewById(R.id.description_text); altitude = (TextView) rootView.findViewById(R.id.altitude_text); proximity = (TextView) rootView.findViewById(R.id.proximity_text); iconValue = null; ImageButton icon = (ImageButton) rootView.findViewById(R.id.icon_button); icon.setImageDrawable(getResources().getDrawable(R.drawable.ic_highlight_remove_white_24dp)); if (waypoint.drawImage) { Bitmap b = BitmapFactory.decodeFile(application.markerPath + File.separator + waypoint.marker); if (b != null) { icon.setImageBitmap(b); iconValue = waypoint.marker; } } icon.setOnClickListener(iconOnClickListener); ArrayList<String> items = new ArrayList<String>(); for (WaypointSet wptset : application.getWaypointSets()) { items.add(wptset.name); } waypointSet = (Spinner) rootView.findViewById(R.id.set_spinner); ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, items); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); waypointSet.setAdapter(adapter); markercolor = (ColorButton) rootView.findViewById(R.id.markercolor_button); textcolor = (ColorButton) rootView.findViewById(R.id.textcolor_button); coordDeg = (ViewGroup) rootView.findViewById(R.id.coord_deg); coordUtm = (ViewGroup) rootView.findViewById(R.id.coord_utm); coordMgrs = (ViewGroup) rootView.findViewById(R.id.coord_mgrs); coordLatDeg = (ViewGroup) rootView.findViewById(R.id.coord_lat_deg); coordLatMin = (ViewGroup) rootView.findViewById(R.id.coord_lat_min); coordLatSec = (ViewGroup) rootView.findViewById(R.id.coord_lat_sec); coordLonDeg = (ViewGroup) rootView.findViewById(R.id.coord_lon_deg); coordLonMin = (ViewGroup) rootView.findViewById(R.id.coord_lon_min); coordLonSec = (ViewGroup) rootView.findViewById(R.id.coord_lon_sec); Spinner coordformat = (Spinner) rootView.findViewById(R.id.coordformat_spinner); coordformat.setOnItemSelectedListener(this); coordformat.setSelection(StringFormatter.coordinateFormat); return rootView; }
Example 18
Source File: TGMeasureRemoveDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 4 votes |
public void fillSpinner(Spinner spinner, int minimum, int maximum) { ArrayAdapter<TGSelectableItem> arrayAdapter = new ArrayAdapter<TGSelectableItem>(getActivity(), android.R.layout.simple_spinner_item, createRangeValues(minimum, maximum)); arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(arrayAdapter); }
Example 19
Source File: LineChartFragment.java From desCharts with Apache License 2.0 | 4 votes |
private void setupViews() { // series tbS1.setChecked(true); tbS2.setChecked(true); tbS3.setChecked(true); ArrayAdapter<String> adS1color = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,colors); ArrayAdapter<String> adS2color = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,colors); ArrayAdapter<String> adS3color = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,colors); adS1color.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); adS2color.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); adS3color.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); spS1color.setAdapter(adS1color); spS2color.setAdapter(adS2color); spS3color.setAdapter(adS2color); spS1color.setSelection(7); spS2color.setSelection(8); spS3color.setSelection(9); ArrayAdapter<String> adS1size = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,widths); ArrayAdapter<String> adS2size = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,widths); ArrayAdapter<String> adS3size = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,widths); adS1size.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); adS2size.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); adS3size.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); spS1size.setAdapter(adS1size); spS2size.setAdapter(adS2size); spS3size.setAdapter(adS2size); spS1size.setSelection(1); spS2size.setSelection(3); spS3size.setSelection(5); cbS1dip.setChecked(true); cbS2dip.setChecked(true); cbS3dip.setChecked(true); // border, axis, grid tbBorder.setChecked(true); tbAxis.setChecked(true); tbGrid.setChecked(true); ArrayAdapter<String> adBorderC = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,colors); ArrayAdapter<String> adAxisC = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,colors); ArrayAdapter<String> adGridC = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,colors); adBorderC.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); adAxisC.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); adGridC.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); spBorderC.setAdapter(adBorderC); spAxisC.setAdapter(adAxisC); spGridC.setAdapter(adGridC); spBorderC.setSelection(6); spAxisC.setSelection(6); spGridC.setSelection(6); // grid size ArrayAdapter<String> adBorderW = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,widths); ArrayAdapter<String> adAxisW = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,widths); ArrayAdapter<String> adGridW = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,widths); adBorderW.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); adAxisW.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); adGridW.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); spBorderW.setAdapter(adBorderW); spAxisW.setAdapter(adAxisW); spGridW.setAdapter(adGridW); spBorderW.setSelection(1); spAxisW.setSelection(1); spGridW.setSelection(1); // dip and antialias checkbox cbUseDip.setChecked(true); cbUseAA.setChecked(true); // text label tbXtext.setChecked(true); tbYtext.setChecked(true); tbXtextBottom.setChecked(true); tbYtextLeft.setChecked(true); // text color and size spinner ArrayAdapter<String> adTextC = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,colors); ArrayAdapter<String> adTextS = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,sizes); adTextC.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); adTextS.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); spTextC.setAdapter(adTextC); spTextS.setAdapter(adTextS); spTextC.setSelection(6); spTextS.setSelection(5); // background color spinner ArrayAdapter<String> adBkgC = new ArrayAdapter<String>(this.getActivity(),android.R.layout.simple_spinner_item,colors); adBkgC.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line); spBkgC.setAdapter(adBkgC); spBkgC.setSelection(0); }
Example 20
Source File: ActivityPublishData.java From gsn with GNU General Public License v3.0 | 4 votes |
public void renderModeList() { List<String> list = new ArrayList<>(); for (String s : STRATEGY) { list.add(s); } ArrayAdapter<String> dataAdapter = new ArrayAdapter<>(this, R.layout.spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); modeSpinner.setAdapter(dataAdapter); modeSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { if (pos != 0) { fromdateEditText.setVisibility(View.GONE); todateEditText.setVisibility(View.GONE); totimeEditText.setVisibility(View.GONE); fromtimeEditText.setVisibility(View.GONE); publishButton.setVisibility(View.GONE); findViewById(R.id.textViewFrom).setVisibility(View.GONE); findViewById(R.id.textViewTo).setVisibility(View.GONE); iterationTime.setVisibility(View.VISIBLE); findViewById(R.id.textIterationTime).setVisibility(View.VISIBLE); } else { fromdateEditText.setVisibility(View.VISIBLE); todateEditText.setVisibility(View.VISIBLE); totimeEditText.setVisibility(View.VISIBLE); fromtimeEditText.setVisibility(View.VISIBLE); publishButton.setVisibility(View.VISIBLE); findViewById(R.id.textViewFrom).setVisibility(View.VISIBLE); findViewById(R.id.textViewTo).setVisibility(View.VISIBLE); iterationTime.setVisibility(View.GONE); findViewById(R.id.textIterationTime).setVisibility(View.GONE); } } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); if (dr != null) { modeSpinner.setSelection(dr.getMode()); } }