當前位置: 首頁>>代碼示例>>Java>>正文


Java ArrayAdapter.setDropDownViewResource方法代碼示例

本文整理匯總了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);
    }
         
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:33,代碼來源:Settings.java

示例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);
}
 
開發者ID:AndyZhu1991,項目名稱:grafika,代碼行數:18,代碼來源:TranscodeActivity.java

示例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);
}
 
開發者ID:MCMrARM,項目名稱:revolution-irc,代碼行數:16,代碼來源:EditNotificationSettingsActivity.java

示例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);
    }
}
 
開發者ID:andresth,項目名稱:Kandroid,代碼行數:10,代碼來源:TaskEditActivity.java

示例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);
}
 
開發者ID:ppdesai434,項目名稱:MavsSnapUp,代碼行數:8,代碼來源:AddItemActivity.java

示例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);
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:30,代碼來源:VideoWidgetConfigure.java

示例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);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:9,代碼來源:UnitConverterActivity.java

示例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);
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:15,代碼來源:BottomSheetShare.java

示例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);
}
 
開發者ID:mapbox,項目名稱:mapbox-plugins-android,代碼行數:11,代碼來源:OfflineDownloadActivity.java

示例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);
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:12,代碼來源:UserDictionaryAddWordFragment.java

示例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;
}
 
開發者ID:victordiaz,項目名稱:phonk,代碼行數:10,代碼來源:PSpinner.java

示例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);
}
 
開發者ID:adithya321,項目名稱:SOS-The-Healthcare-Companion,代碼行數:17,代碼來源:LabelledSpinner.java

示例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) {
        }
      });
}
 
開發者ID:Elias33,項目名稱:Quran,代碼行數:36,代碼來源:AyahPlaybackFragment.java

示例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();
    });
}
 
開發者ID:MCMrARM,項目名稱:revolution-irc,代碼行數:39,代碼來源:ReconnectIntervalSetting.java

示例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;
}
 
開發者ID:XFY9326,項目名稱:CatchSpy,代碼行數:6,代碼來源:ApplicationMethod.java


注:本文中的android.widget.ArrayAdapter.setDropDownViewResource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。