List of usage examples for android.widget ArrayAdapter setDropDownViewResource
public void setDropDownViewResource(@LayoutRes int resource)
Sets the layout resource to create the drop down views.
From source file:com.appnexus.opensdkapp.SettingsFragment.java
private static Spinner initDropdown(View out, ViewGroup container, int resId, int stringsId) { Spinner dropdown = (Spinner) out.findViewById(resId); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(container.getContext(), stringsId, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); dropdown.setAdapter(adapter);//ww w.j a va2 s . co m return dropdown; }
From source file:com.nextgis.mobile.map.LocalTMSLayer.java
protected static void showPropertiesDialog(final MapBase map, final boolean bCreate, String layerName, int type, final Uri uri, final LocalTMSLayer layer) { final LinearLayout linearLayout = new LinearLayout(map.getContext()); final EditText input = new EditText(map.getContext()); input.setText(layerName);/*w ww. jav a2 s . c o m*/ final ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(map.getContext(), android.R.layout.simple_spinner_item); final Spinner spinner = new Spinner(map.getContext()); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); adapter.add(map.getContext().getString(R.string.tmstype_qtiles)); adapter.add(map.getContext().getString(R.string.tmstype_osm)); adapter.add(map.getContext().getString(R.string.tmstype_normal)); adapter.add(map.getContext().getString(R.string.tmstype_ngw)); if (type == TMSTYPE_OSM) { spinner.setSelection(1); } else { spinner.setSelection(2); } final TextView stLayerName = new TextView(map.getContext()); stLayerName.setText(map.getContext().getString(R.string.layer_name) + ":"); final TextView stLayerType = new TextView(map.getContext()); stLayerType.setText(map.getContext().getString(R.string.layer_type) + ":"); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.addView(stLayerName); linearLayout.addView(input); linearLayout.addView(stLayerType); linearLayout.addView(spinner); new AlertDialog.Builder(map.getContext()) .setTitle(bCreate ? R.string.input_layer_properties : R.string.change_layer_properties) // .setMessage(message) .setView(linearLayout).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { int tmsType = 0; switch (spinner.getSelectedItemPosition()) { case 0: case 1: tmsType = TMSTYPE_OSM; break; case 2: case 3: tmsType = TMSTYPE_NORMAL; break; } if (bCreate) { create(map, input.getText().toString(), tmsType, uri); } else { layer.setName(input.getText().toString()); layer.setTMSType(tmsType); map.onLayerChanged(layer); } } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Do nothing. Toast.makeText(map.getContext(), R.string.error_cancel_by_user, Toast.LENGTH_SHORT).show(); } }).show(); }
From source file:net.palacesoft.cngstation.client.loader.CityLoader.java
@Override protected void onPostExecute(List<String> citiesList) { ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(stationActivity, simple_spinner_item, citiesList);//from w w w. jav a 2 s .c o m dataAdapter.setDropDownViewResource(simple_spinner_dropdown_item); stationActivity.getCities().setAdapter(dataAdapter); progressDialog.dismiss(); }
From source file:com.gsma.rcs.provisioning.local.LoggerProvisioning.java
@Override public void displayRcsSettings() { if (sLogger.isActivated()) { sLogger.debug("displayRcsSettings"); }/* w w w.j a v a 2s . co m*/ mHelper.setBoolCheckBox(R.id.TraceActivated, RcsSettingsData.TRACE_ACTIVATED); mHelper.setBoolCheckBox(R.id.SipTraceActivated, RcsSettingsData.SIP_TRACE_ACTIVATED); mHelper.setBoolCheckBox(R.id.MediaTraceActivated, RcsSettingsData.MEDIA_TRACE_ACTIVATED); mHelper.setStringEditText(R.id.SipTraceFile, RcsSettingsData.SIP_TRACE_FILE); Spinner spinner = (Spinner) mRootView.findViewById(R.id.TraceLevel); ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, TRACE_LEVEL); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setSelection(sRcsSettings.getTraceLevel()); }
From source file:com.google.android.gms.example.apidemo.DFPCustomTargetingFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mSportsSpinner = (Spinner) getView().findViewById(R.id.customtargeting_spn_sport); mLoadButton = (Button) getView().findViewById(R.id.customtargeting_btn_loadad); mAdView = (PublisherAdView) getView().findViewById(R.id.customtargeting_av_main); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getView().getContext(), R.array.customtargeting_sports, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mSportsSpinner.setAdapter(adapter);/* w ww . j a v a2 s . c o m*/ mLoadButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PublisherAdRequest adRequest = new PublisherAdRequest.Builder().addCustomTargeting( getString(R.string.customtargeting_key), (String) mSportsSpinner.getSelectedItem()).build(); mAdView.loadAd(adRequest); } }); }
From source file:com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.Inputs.Input_SpinnerFragment.java
public void spinnerAdapter() { ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), R.layout.support_simple_spinner_dropdown_item, getResources().getStringArray(R.array.spinner_array)); adapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item); spinner.setAdapter(adapter);/*from w ww. j av a 2s. c o m*/ }
From source file:com.uwetrottmann.movies.ui.MoviesActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.movies_activity); final ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); ArrayAdapter<CharSequence> mActionBarList = ArrayAdapter.createFromResource(this, R.array.movie_lists, R.layout.sherlock_spinner_item); mActionBarList.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item); actionBar.setListNavigationCallbacks(mActionBarList, this); // try to restore previously set nav item final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); final int navItem = prefs.getInt(AppPreferences.KEY_NAVSELECTION, 0); actionBar.setSelectedNavigationItem(navItem); }
From source file:com.willowtreeapps.spurceexampleapp.SpruceActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_pager); FragmentManager fm = getSupportFragmentManager(); VerticalViewPager verticalPager = (VerticalViewPager) findViewById(R.id.vertical_pager); VerticalPagerAdapter adapter = new VerticalPagerAdapter(fm); verticalPager.setAdapter(adapter);//from ww w.ja v a 2 s. c o m Toolbar toolBar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolBar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayShowTitleEnabled(false); } sortDropDown = (Spinner) findViewById(R.id.sort_selection); ArrayAdapter<CharSequence> spinnerAdapter = ArrayAdapter.createFromResource(this, R.array.sort_functions, R.layout.spinner_item); spinnerAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item); sortDropDown.setAdapter(spinnerAdapter); }
From source file:com.google.mcommerce.sample.android.chapter09.googleMap.LayersDemoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.c09_layers_demo); mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); Spinner spinner = (Spinner) findViewById(R.id.layers_spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.layers_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter);/*from w ww . ja v a2 s .com*/ spinner.setOnItemSelectedListener(this); setUpMapIfNeeded(); }
From source file:at.aau.nes.mjoelnir.aggregatedData.AddReadingDialog.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_add_reading_dialog, container, false); // Set a spinner to select either production or consumption spinner = (Spinner) v.findViewById(R.id.spinner_consprod_selection); ArrayAdapter<String> device_selector = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, new String[] { "Consumption", "Production" }); device_selector.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(device_selector); ev = (EnergyScanView) v.findViewById(R.id.energy_scan_view); //ev.setConfigFromJsonString(getConfigFile(getResources().openRawResource(R.raw.ocr_configuration))); ev.initAnyline(getString(R.string.anyline_license_key), this); return v;/*from ww w.j a va 2s . com*/ }