当前位置: 首页>>代码示例>>Java>>正文


Java MultiAutoCompleteTextView.setAdapter方法代码示例

本文整理汇总了Java中android.widget.MultiAutoCompleteTextView.setAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java MultiAutoCompleteTextView.setAdapter方法的具体用法?Java MultiAutoCompleteTextView.setAdapter怎么用?Java MultiAutoCompleteTextView.setAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.MultiAutoCompleteTextView的用法示例。


在下文中一共展示了MultiAutoCompleteTextView.setAdapter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.widget.MultiAutoCompleteTextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    autoComplete = (AutoCompleteTextView)findViewById(R.id.autoComplete);
    multiComplete = (MultiAutoCompleteTextView)findViewById(R.id.multiAutoComplete);

    // The lists to be shown to the user.
    String[] lists = {"Hello-World", "Hello-Thanks", "Hello-Morning",
                      "Bye-World", "Bye-Thanks", "Bye-Morning"};

    // To link the data and the view, we should use 'Adapter'.
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_dropdown_item_1line,
            lists);

    // Link the adapter above to the view.
    autoComplete.setAdapter(adapter);


    // Set the tokenizer for the multiComplete.
    multiComplete.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    multiComplete.setAdapter(adapter);
}
 
开发者ID:Jamjomjara,项目名称:snu-artoon,代码行数:26,代码来源:MainActivity.java

示例2: onCreate

import android.widget.MultiAutoCompleteTextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.appcompat_widgets_text_input);

    // Fetch the AutoCompleteTextView and set an adapter
    AutoCompleteTextView actv = (AutoCompleteTextView) findViewById(
            R.id.widgets_autocompletetextview);
    actv.setAdapter(new ArrayAdapter<>(this,
            android.R.layout.simple_dropdown_item_1line, Cheeses.sCheeseStrings));

    // Fetch the MultiAutoCompleteTextView and set an adapter and Tokenizer
    MultiAutoCompleteTextView mactv = (MultiAutoCompleteTextView) findViewById(
            R.id.widgets_multiautocompletetextview);
    mactv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    mactv.setAdapter(new ArrayAdapter<>(this,
            android.R.layout.simple_dropdown_item_1line, Cheeses.sCheeseStrings));
}
 
开发者ID:wangkang0627,项目名称:android-support-learn,代码行数:19,代码来源:AppCompatWidgetsTextInput.java

示例3: RhythmSandbox

import android.widget.MultiAutoCompleteTextView; //导入方法依赖的package包/类
/**
 * Initialize a presenter for sandbox
 *
 * @param activity        Activity that hosts this sandbox
 * @param rootView        Root view of the sandbox
 * @param overlayInflater Overlay inflater used to inflate rhythm config
 */
public RhythmSandbox(AppCompatActivity activity, View rootView, RhythmOverlayInflater overlayInflater) {
    mActivity = activity;
    mOverlayInflater = overlayInflater;

    // Find and init preview layout
    mPreview = (RhythmFrameLayout) rootView.findViewById(R.id.preview);
    mPreview.setRhythmDrawable(new RhythmDrawable(null));

    // Find and init overlay config text box
    mOverlayConfig = (MultiAutoCompleteTextView) rootView.findViewById(R.id.config);
    mOverlayConfig.setHorizontallyScrolling(true);

    // Fix config text box metrics
    int i4dp = activity.getResources().getDimensionPixelOffset(R.dimen.i4dp);
    Utils.setExactMetrics(mOverlayConfig, i4dp * 6, i4dp * 5, i4dp * 3);

    // Enable auto-complete for config
    ArrayAdapter<String> adapter = new ArrayAdapter<>(activity, android.R.layout.simple_dropdown_item_1line, ALL_CONFIG_WORDS);
    mOverlayConfig.setTokenizer(new ConfigTokenizer());
    mOverlayConfig.setAdapter(adapter);

    // Find and init Apply button
    final Button applyButton = (Button) rootView.findViewById(R.id.apply);
    applyButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            updatePreview();
        }
    });
}
 
开发者ID:Actinarium,项目名称:Rhythm,代码行数:38,代码来源:RhythmSandbox.java

示例4: onCreate

import android.widget.MultiAutoCompleteTextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.autocomplete_6);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_dropdown_item_1line, COUNTRIES);
    MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.edit);
    textView.setAdapter(adapter);
    textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:12,代码来源:AutoComplete6.java

示例5: onCreate

import android.widget.MultiAutoCompleteTextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mApp = (ImApp)getApplication();
    mHandler = new SimpleAlertHandler(this);
    resolveIntent(getIntent());

    setContentView(R.layout.add_contact_activity);

    BrandingResources brandingRes = mApp.getBrandingResource(mProviderId);
    setTitle(brandingRes.getString(BrandingResourceIDs.STRING_ADD_CONTACT_TITLE));

    TextView label = (TextView) findViewById(R.id.input_contact_label);
    label.setText(brandingRes.getString(BrandingResourceIDs.STRING_LABEL_INPUT_CONTACT));

    mAddressList = (MultiAutoCompleteTextView) findViewById(R.id.email);
    mAddressList.setAdapter(new EmailAddressAdapter(this));
    mAddressList.setTokenizer(new Rfc822Tokenizer());
    mAddressList.addTextChangedListener(mTextWatcher);

    mListSpinner = (Spinner) findViewById(R.id.choose_list);

    Cursor c = queryContactLists();
    int initSelection = searchInitListPos(c,
            getIntent().getStringExtra(ImServiceConstants.EXTRA_INTENT_LIST_NAME));
    SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
            android.R.layout.simple_spinner_item, c, new String[] { Imps.ContactList.NAME },
            new int[] { android.R.id.text1 });
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mListSpinner.setAdapter(adapter);
    mListSpinner.setSelection(initSelection);
    
    mInviteButton = (Button) findViewById(R.id.invite);
    mInviteButton.setText(brandingRes.getString(BrandingResourceIDs.STRING_BUTTON_ADD_CONTACT));
    mInviteButton.setOnClickListener(mButtonHandler);
    mInviteButton.setEnabled(false);
}
 
开发者ID:prive,项目名称:prive-android,代码行数:39,代码来源:AddContactActivity.java

示例6: createNewMultiCompleteTextView

import android.widget.MultiAutoCompleteTextView; //导入方法依赖的package包/类
private MultiAutoCompleteTextView createNewMultiCompleteTextView() {

		MultiAutoCompleteTextView view = new MultiAutoCompleteTextView(
				getActivity());
		view.setLayoutParams(textViews.get(0).getLayoutParams());
		view.setAdapter(adapter);
		setupTextViewDropdowns(view);
		view.setHint(getActivity().getString(R.string.from));
		textViews.add(view);
		setupImeTypesAndListner(view);
		setupfocusCHangeListener(view);

		return view;

	}
 
开发者ID:marbergq,项目名称:Multiplanner,代码行数:16,代码来源:SearchFragment.java

示例7: populateContactSearch

import android.widget.MultiAutoCompleteTextView; //导入方法依赖的package包/类
private void populateContactSearch() {
	List<String> contacts = new ArrayList<String>();
	ContentResolver cr = this.getContentResolver();
	Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, CONTACT_COLUMNS, null, null, null);
	while (cursor.moveToNext()) {
		String name = cursor.getString(0);
		contacts.add(name);
	}
	cursor.close();

	ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.contact_list_item, contacts.toArray(new String[] {}));
	MultiAutoCompleteTextView txtFriends = (MultiAutoCompleteTextView) findViewById(R.id.newVisitFriends);
	txtFriends.setAdapter(adapter);
	txtFriends.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
 
开发者ID:jarwol,项目名称:WheredWeEat,代码行数:16,代码来源:NewVisitActivity.java

示例8: handleIntent

import android.widget.MultiAutoCompleteTextView; //导入方法依赖的package包/类
/**
 * Handle {@link Intent}.
 *
 * @param intent {@link Intent}
 */
@SuppressWarnings("deprecation")
private void handleIntent(final Intent intent) {
    if (parseIntent(intent)) {
        setTheme(android.R.style.Theme_Translucent_NoTitleBar);
        send();
        finish();
    } else {
        int tid = getThreadId();
        if (tid >= 0) {
            Intent i = new Intent(Intent.ACTION_VIEW, Uri.withAppendedPath(
                    ConversationListActivity.URI, String.valueOf(tid)), this,
                    MessageListActivity.class);
            i.putExtra("showKeyboard", true);
            startActivity(i);
            finish();
        } else {
            setTheme(PreferencesActivity.getTheme(this));
            setContentView(R.layout.sender);
            findViewById(R.id.text_paste).setOnClickListener(this);
            final EditText et = (EditText) findViewById(R.id.text);
            et.addTextChangedListener(new MyTextWatcher(this, (TextView) this
                    .findViewById(R.id.text_paste), (TextView) findViewById(R.id.text_)));
            et.setText(text);
            final MultiAutoCompleteTextView mtv = (MultiAutoCompleteTextView) this
                    .findViewById(R.id.to);
            final MobilePhoneAdapter mpa = new MobilePhoneAdapter(this);
            final SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(this);
            MobilePhoneAdapter.setMobileNumbersOnly(p.getBoolean(
                    PreferencesActivity.PREFS_MOBILE_ONLY, false));
            mtv.setAdapter(mpa);
            mtv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
            mtv.setText(to);
            if (!TextUtils.isEmpty(to)) {
                to = to.trim();
                if (to.endsWith(",")) {
                    to = to.substring(0, to.length() - 1).trim();
                }
                if (to.indexOf('<') < 0) {
                    // try to fetch recipient's name from phone book
                    String n = ContactsWrapper.getInstance().getNameForNumber(
                            getContentResolver(), to);
                    if (n != null) {
                        to = n + " <" + to + ">, ";
                    }
                }
                mtv.setText(to);
                et.requestFocus();
            } else {
                mtv.requestFocus();
            }
            cbmgr = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
            int flags = et.getInputType();
            if (p.getBoolean(PreferencesActivity.PREFS_EDIT_SHORT_TEXT, true)) {
                flags |= InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE;
            } else {
                flags &= ~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE;
            }
            et.setInputType(flags);
        }
    }
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:67,代码来源:SenderActivity.java

示例9: onCreateView

import android.widget.MultiAutoCompleteTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_restore, container, false);

    Fonts.setTypeface(view.findViewById(R.id.coins_icon), Fonts.Font.COINOMI_FONT_ICONS);

    ImageButton scanQrButton = (ImageButton) view.findViewById(R.id.scan_qr_code);
    scanQrButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            handleScan();
        }
    });

    // Setup auto complete the mnemonic words
    ArrayAdapter<String> adapter = new ArrayAdapter<>(this.getActivity(),
            R.layout.item_simple, MnemonicCode.INSTANCE.getWordList());
    mnemonicTextView = (MultiAutoCompleteTextView) view.findViewById(R.id.seed);
    mnemonicTextView.setAdapter(adapter);
    mnemonicTextView.setTokenizer(new SpaceTokenizer() {
        @Override
        public void onToken() {
            clearError(errorMnemonicΜessage);
        }
    });

    // Restore message
    errorMnemonicΜessage = (TextView) view.findViewById(R.id.restore_message);
    errorMnemonicΜessage.setVisibility(View.GONE);

    bip39Passphrase = (EditText) view.findViewById(R.id.bip39_passphrase);
    final View bip39PassphraseTitle = view.findViewById(R.id.bip39_passphrase_title);

    bip39Passphrase.setVisibility(View.GONE);
    bip39PassphraseTitle.setVisibility(View.GONE);

    // For existing seed
    final View bip39Info = view.findViewById(R.id.bip39_info);
    bip39Info.setVisibility(View.GONE);
    final CheckBox useBip39Checkbox = (CheckBox) view.findViewById(R.id.use_bip39);
    if (isNewSeed) useBip39Checkbox.setVisibility(View.GONE);

    useBip39Checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            isSeedProtected = isChecked;
            if (isChecked) {
                if (isNewSeed) skipButton.setVisibility(View.GONE);
                bip39Info.setVisibility(View.VISIBLE);
                bip39PassphraseTitle.setVisibility(View.VISIBLE);
                bip39Passphrase.setVisibility(View.VISIBLE);
            } else {
                if (isNewSeed) skipButton.setVisibility(View.VISIBLE);
                bip39Info.setVisibility(View.GONE);
                bip39PassphraseTitle.setVisibility(View.GONE);
                bip39Passphrase.setVisibility(View.GONE);
                bip39Passphrase.setText(null);
            }
        }
    });

    // Skip link
    skipButton = (Button) view.findViewById(R.id.seed_entry_skip);
    if (isNewSeed) {
        skipButton.setOnClickListener(getOnSkipListener());
        skipButton.setVisibility(View.VISIBLE);
    } else {
        skipButton.setVisibility(View.GONE);
    }

    // Next button
    view.findViewById(R.id.button_next).setOnClickListener(getOnNextListener());

    return view;
}
 
开发者ID:filipnyquist,项目名称:lbry-android,代码行数:78,代码来源:RestoreFragment.java


注:本文中的android.widget.MultiAutoCompleteTextView.setAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。