本文整理汇总了Java中android.widget.ArrayAdapter.setDropDownViewResource方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayAdapter.setDropDownViewResource方法的具体用法?Java ArrayAdapter.setDropDownViewResource怎么用?Java ArrayAdapter.setDropDownViewResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ArrayAdapter
的用法示例。
在下文中一共展示了ArrayAdapter.setDropDownViewResource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
Button endgame = (Button) findViewById(R.id.endgame);
endgame.setOnClickListener(ClickListener);
Spinner spinner = (Spinner) findViewById(R.id.sphofentries);
ArrayAdapter adapter = ArrayAdapter.createFromResource( this, R.array.hofentries_array , android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(ItemSelectedListener);
RadioButton rbclassic = (RadioButton) findViewById(R.id.rbclassic);
RadioButton rbletters = (RadioButton) findViewById(R.id.rbletters);
rbclassic.setOnClickListener(RadioListener);
rbletters.setOnClickListener(RadioListener);
prefs = new Preferences(this); // Instantiating Preferences in prefs global variable
spinner.setSelection(prefs.scoresnumpos);
if (prefs.notationstyle == "classic") {
rbclassic.setChecked(true);
rbletters.setChecked(false);
}
else if (prefs.notationstyle == "letters") {
rbclassic.setChecked(false);
rbletters.setChecked(true);
}
}
示例2: init
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
private void init() {
mMovieFiles = new ArrayList<>(Arrays.asList(MiscUtils.getFilesReal(getExternalCacheDir(), "*.mp4")));
mMovieFiles.addAll(Arrays.asList(MiscUtils.getFilesReal(getExternalCacheDir(), "*.mp4")));
mMovieNames = new ArrayList<>();
for (File file: mMovieFiles) {
mMovieNames.add(file.getName());
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, mMovieNames);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner.
mSpinner.setAdapter(adapter);
mSpinner.setOnItemSelectedListener(this);
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setIndeterminate(true);
}
示例3: refreshSpinner
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
private void refreshSpinner() {
mSpinnerOptionUUIDs = new ArrayList<>();
List<String> options = new ArrayList<>();
options.add(mServerSpinner.getContext().getString(R.string.value_any));
mSpinnerOptionUUIDs.add(null);
for (ServerConfigData data :
ServerConfigManager.getInstance(mServerSpinner.getContext()).getServers()) {
options.add(data.name);
mSpinnerOptionUUIDs.add(data.uuid);
}
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(mServerSpinner.getContext(),
R.layout.simple_spinner_item, android.R.id.text1, options);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mServerSpinner.setAdapter(spinnerAdapter);
}
示例4: onGetColumns
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
@Override
public void onGetColumns(boolean success, List<KanboardColumn> result) {
if (success) {
projectColumns = result;
ArrayAdapter<KanboardColumn> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, projectColumns);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerColumns.setAdapter(adapter);
}
}
示例5: populateSpinner
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
protected void populateSpinner() {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(
this, android.R.layout.simple_spinner_item, categories);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner sItems = (Spinner) findViewById(R.id.catSpinner);
sItems.setAdapter(adapter);
}
示例6: onCreate
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
// Retrieve the widget id provided by the intent
mAppWidgetId = getIntent().getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
// Set the Activity result to RESULT_CANCELED immediately : thus the App Widget host will always be notified
// in case of error or if the user cancels the configuration and the App Widget will not be added
notifyResult(RESULT_CANCELED);
if (mAppWidgetId == -1) {
// Error, no id provided
finish();
}
setContentView(R.layout.widget_configuration);
// Content spinner setup
Spinner contentSpinner = (Spinner)findViewById(R.id.content_spinner);
ArrayAdapter<CharSequence> contentAdapter = ArrayAdapter.createFromResource(this, R.array.video_content_array, android.R.layout.simple_spinner_item);
contentAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
contentSpinner.setAdapter(contentAdapter);
contentSpinner.setOnItemSelectedListener(new OnContentItemSelectedListener());
mValidateButton = (Button)findViewById(R.id.validate_button);
mValidateButton.setOnClickListener(mValidateButtonClickListener);
}
示例7: initSpinners
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
private void initSpinners(int category) {
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, this.getCategoryArrayResId(category),
android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
this.inputUnit.setAdapter(adapter);
this.outputUnit.setAdapter(adapter);
}
示例8: onStart
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
@Override
public void onStart() {
super.onStart();
// Create an ArrayAdapter using the string array and a default spinner layout
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(), R.array.post_share_types, R.layout.adapter_spinner_item);
// Specify the layout to use when the list of choices appears
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner
mContentType.setAdapter(adapter);
mContentType.setOnItemSelectedListener(this);
if(bottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED)
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
示例9: initSpinner
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
private void initSpinner() {
List<String> styles = new ArrayList<>();
styles.add(Style.MAPBOX_STREETS);
styles.add(Style.DARK);
styles.add(Style.LIGHT);
styles.add(Style.OUTDOORS);
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, styles);
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
styleUrlView.setAdapter(spinnerArrayAdapter);
}
示例10: updateSpinner
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
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);
}
示例11: setData
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
public PSpinner setData(String[] data) {
this.mData = data;
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, mData);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
this.setAdapter(adapter);
return this;
}
示例12: setItemsArray
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
/**
* Sets the array of items to be used in the Spinner.
*
* @param list The List used as the data source
* @see #setItemsArray(int)
* @see #setItemsArray(int, int, int)
*/
public void setItemsArray(final List<?> list) {
ArrayAdapter<?> adapter = new ArrayAdapter<>(
getContext(),
android.R.layout.simple_spinner_item,
list);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
setAdapter(adapter);
}
示例13: initializeSuraSpinner
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
private void initializeSuraSpinner(final Context context,
QuranSpinner spinner, final ArrayAdapter<CharSequence> ayahAdapter) {
String[] suras = context.getResources().
getStringArray(R.array.sura_names);
for (int i=0; i<suras.length; i++){
suras[i] = QuranUtils.getLocalizedNumber(context, (i + 1)) +
". " + suras[i];
}
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(
context, ITEM_LAYOUT, suras);
adapter.setDropDownViewResource(ITEM_DROPDOWN_LAYOUT);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(
new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long rowId) {
int sura = position + 1;
int ayahCount = QuranInfo.getNumAyahs(sura);
CharSequence[] ayahs = new String[ayahCount];
for (int i = 0; i < ayahCount; i++){
ayahs[i] = QuranUtils.getLocalizedNumber(context, (i + 1));
}
ayahAdapter.clear();
for (int i=0; i<ayahCount; i++){
ayahAdapter.add(ayahs[i]);
}
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
}
示例14: RuleViewHolder
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
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();
});
}
示例15: getSpinnerAdapter
import android.widget.ArrayAdapter; //导入方法依赖的package包/类
public static ArrayAdapter<String> getSpinnerAdapter(Context context, String[] data) {
ArrayAdapter<String> adapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_item, data);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
return adapter;
}