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


Java MultiAutoCompleteTextView類代碼示例

本文整理匯總了Java中android.widget.MultiAutoCompleteTextView的典型用法代碼示例。如果您正苦於以下問題:Java MultiAutoCompleteTextView類的具體用法?Java MultiAutoCompleteTextView怎麽用?Java MultiAutoCompleteTextView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MultiAutoCompleteTextView類屬於android.widget包,在下文中一共展示了MultiAutoCompleteTextView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: saveActivityState

import android.widget.MultiAutoCompleteTextView; //導入依賴的package包/類
private void saveActivityState() {
    MultiAutoCompleteTextView taskTextEditText = (MultiAutoCompleteTextView) findViewById(R.id.task_text_edit_text);
    if (taskTextEditText != null) {
        String taskText = taskTextEditText.getText().toString();
    
        if (!taskText.equals("")) {
        
            String[] state = new String[]{
                    taskText,
                    mTeam,
                    mDoneDate
            };
            Utils.setNewTaskActivityState(this, state);

            //Log.i(LOG_TAG, "Saved: " + state[0] + ", " + state[1]);
        } else
            Utils.clearNewTaskActivityState(this);
    }
}
 
開發者ID:adityabhaskar,項目名稱:DoneForAndroid,代碼行數:20,代碼來源:NewDoneActivity.java

示例3: onCreate

import android.widget.MultiAutoCompleteTextView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String mAction = getIntent().getAction();
    getToolbar().setTitle(mAction + getString(R.string.activity_create_title_suffix));

    boolean isEdit = false;
    if (mAction != null) {
        isEdit = mAction.equals(Consts.MESSAGE_EDIT);
    }

    mContact.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    BaseRecipientAdapter adapter = new BaseRecipientAdapter(
            BaseRecipientAdapter.QUERY_TYPE_PHONE, this);
    adapter.setShowMobileOnly(true);
    mContact.setAdapter(adapter);
    mContact.dismissDropDownOnItemSelected(true);

    if (isEdit) {
        mMessageId = getIntent().getExtras().getLong(Consts.KEY_MESSAGE_ID);
        Message message = Message.findById(Message.class, mMessageId);
        populate(message);
    } else {
        setDate(new Date());
    }
}
 
開發者ID:jordond,項目名稱:hooold,代碼行數:27,代碼來源:CreateActivity.java

示例4: 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

示例5: onActivityResult

import android.widget.MultiAutoCompleteTextView; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
   protected void onActivityResult(int requestCode, int resultCode, Intent data) {
       super.onActivityResult(requestCode, resultCode, data);

       switch(requestCode) {
       case Constants.REQUEST_CODE_USER_SELECTOR:
           if (resultCode == Constants.RESULT_CODE_SUCCESS) {
               List<User> userList = (List<User>)data.getSerializableExtra("LIST_USER");
               if (ListUtil.isEmpty(userList)) {
               	userList = new ArrayList<User>();
               }
               MultiAutoCompleteTextView etText  =
               	(MultiAutoCompleteTextView)this.findViewById(R.id.etText);
               StringBuilder mentions = new StringBuilder("");
               for (User user : userList) {
                   mentions.append(user.getMentionName()).append(" ");
               }
               int currentPos = etText.getSelectionStart();
               etText.getText().insert(currentPos, mentions);
           }
           break;
       default:
           break;
       }
   }
 
開發者ID:cattong,項目名稱:YiBo,代碼行數:27,代碼來源:EditCommentActivity.java

示例6: initMultiAutoCompleteTextView

import android.widget.MultiAutoCompleteTextView; //導入依賴的package包/類
private MultiAutoCompleteTextView initMultiAutoCompleteTextView(RecipientEditTextView list) {
    if (ChipsUtil.supportsChipsUi()) {
        mAddressAdapter = new RecipientAdapter(mActivity);
        list.setAdapter((BaseRecipientAdapter) mAddressAdapter);
        list.setOnFocusListShrinkRecipients(false);
    } else {
        mAddressAdapter = new EmailAddressAdapter(mActivity);
        list.setAdapter((EmailAddressAdapter)mAddressAdapter);
    }
    list.setTokenizer(new Rfc822Tokenizer());
    list.setValidator(mEmailValidator);

    // NOTE: assumes no other filters are set
    list.setFilters(sRecipientFilters);

    return list;
}
 
開發者ID:x7hub,項目名稱:Calendar_lunar,代碼行數:18,代碼來源:EditEventView.java

示例7: setTextInTextViews

import android.widget.MultiAutoCompleteTextView; //導入依賴的package包/類
protected void setTextInTextViews(Location selectedItem) {
	if (plan.getFrom() != null) {
		// for(Location l : plan.getFrom())
		for (MultiAutoCompleteTextView view : textViews) {

			if (view.getText().toString().length() > 0
					&& !doesPlanContainthis(view.getText().toString())) {
				view.setText(selectedItem.getDisplayname());
				break;
			}
		}
	} else {
		textViews.get(0).setText(selectedItem.getDisplayname());
	}

}
 
開發者ID:marbergq,項目名稱:Multiplanner,代碼行數:17,代碼來源:SearchFragment.java

示例8: plannerSameSizeAsTextViews

import android.widget.MultiAutoCompleteTextView; //導入依賴的package包/類
private int plannerSameSizeAsTextViews() {
	int plancount = 0;
	int textViewCount = 0;
	if (plan.getFrom() != null)
		plancount = plan.getFrom().size();
	for (MultiAutoCompleteTextView textView : textViews) {
		if (!textView.getText().toString().isEmpty())
			textViewCount++;
	}
	if (plancount == textViewCount)
		return 0;
	else if (plancount > textViewCount)
		return -1;
	else
		return 1;

}
 
開發者ID:marbergq,項目名稱:Multiplanner,代碼行數:18,代碼來源:SearchFragment.java

示例9: setupAccountHistory

import android.widget.MultiAutoCompleteTextView; //導入依賴的package包/類
public static void setupAccountHistory( AutoCompleteTextView... autoTextViewArray ) {
    for ( AutoCompleteTextView actv : autoTextViewArray ) {
        AccountAdapter adapter = new AccountAdapter(actv.getContext(), R.layout.account_suggestion, R.id.eos_account);
        if (actv instanceof MultiAutoCompleteTextView) {
            ((MultiAutoCompleteTextView) actv).setTokenizer(new WhitSpaceTokenizer());
        }
        actv.setThreshold(1);
        actv.setAdapter(adapter);
    }
}
 
開發者ID:mithrilcoin-io,項目名稱:EosCommander,代碼行數:11,代碼來源:UiUtils.java

示例10: RecipientsEditorTokenizer

import android.widget.MultiAutoCompleteTextView; //導入依賴的package包/類
RecipientsEditorTokenizer(Context context, MultiAutoCompleteTextView list) {
    mInflater = LayoutInflater.from(context);
    mList = list;

    final int size = android.R.style.TextAppearance_Small;
    final int color = 8;//android.R.styleable.Theme_textColorSecondary;
    mLabelSpan = new TextAppearanceSpan(context, size, color);
    mTypeSpan = new TextAppearanceSpan(context, size, color);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:10,代碼來源:RecipientsEditor.java

示例11: onViewCreated

import android.widget.MultiAutoCompleteTextView; //導入依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    this.mRecyclerView = (RecyclerView) view.findViewById(R.id.cp_listView);
    this.mNachoTextView = (NachoTextView) view.findViewById(R.id.nachoTextView);

    this.mNachoTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    this.mNachoTextView.setThreshold(3);
    this.mNachoTextView.setMaxLines(2);
    this.mNachoTextView.addChipTerminator(' ', ChipTerminatorHandler.BEHAVIOR_CHIPIFY_TO_TERMINATOR);
    this.mNachoTextView.setChipTokenizer(new SpanChipTokenizer<>(getContext(), new ContactChipCreator(), ChipSpan.class));

}
 
開發者ID:quiin,項目名稱:UnifiedContactPicker,代碼行數:14,代碼來源:ContactPickerFragment.java

示例12: onCreateView

import android.widget.MultiAutoCompleteTextView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the diet_raw_layout for this fragment

    ViewGroup rootView = (ViewGroup)inflater.inflate(R.layout.fragment_settings, container, false);
    // Inflate the diet_raw_layout for this fragment


    lv = (ListView) rootView.findViewById(R.id.ingr_listviewSett);
    lv2 = (ListView) rootView.findViewById(R.id.dietListSett);
    calorieSeekBar = (RangeSeekBar<Integer>) rootView.findViewById(R.id.seekbarForCalorieSett);
    calorieSeekBar.setOnRangeSeekBarChangeListener(seekBarChnaged());
    fatSeekBar = (RangeSeekBar<Integer>) rootView.findViewById(R.id.seekBarForFatSett);
    fatSeekBar.setOnRangeSeekBarChangeListener(seekBarChnaged());
    proSeekBar = (RangeSeekBar<Integer>) rootView.findViewById(R.id.rangeSeekBarForProSett);
    proSeekBar.setOnRangeSeekBarChangeListener(seekBarChnaged());
    carbSeekBar = (RangeSeekBar<Integer>) rootView.findViewById(R.id.seekBarForCabSett);
    carbSeekBar.setOnRangeSeekBarChangeListener(seekBarChnaged());
    mtext1 = (MultiAutoCompleteTextView)rootView.findViewById(R.id.multiAutoCompleteTextView1Sett);
    saveBut = (Button) rootView.findViewById(R.id.saveDietSett);
    name = (EditText) rootView.findViewById(R.id.editTextNameSett);
    descr = (EditText)rootView.findViewById(R.id.editTextDescSett);
    return  rootView;


}
 
開發者ID:bounswe,項目名稱:bounswe2016group2,代碼行數:28,代碼來源:SettingsFragment.java

示例13: 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

示例14: addAddresses

import android.widget.MultiAutoCompleteTextView; //導入依賴的package包/類
private void addAddresses(MultiAutoCompleteTextView view, String addresses) {
    if (StringUtils.isNullOrEmpty(addresses)) {
        return;
    }
    for (String address : addresses.split(",")) {
        addAddress(view, new Address(address, ""));
    }
}
 
開發者ID:daxslab,項目名稱:daxSmail,代碼行數:9,代碼來源:MessageCompose.java

示例15: init

import android.widget.MultiAutoCompleteTextView; //導入依賴的package包/類
private void init(Context context) {
    mContext = (QKActivity) context;

    mAdapter = new BaseRecipientAdapter(BaseRecipientAdapter.QUERY_TYPE_PHONE, getContext());

    setThreshold(1);
    setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    setAdapter(mAdapter);
    setOnItemClickListener(this);

    LiveViewManager.registerView(QKPreference.FONT_FAMILY, this, key -> {
        setTypeface(FontManager.getFont(mContext));
    });

    LiveViewManager.registerView(QKPreference.FONT_WEIGHT, this, key -> {
        setTypeface(FontManager.getFont(mContext));
    });

    LiveViewManager.registerView(QKPreference.FONT_SIZE, this, key -> {
        setTextSize(TypedValue.COMPLEX_UNIT_SP, FontManager.getTextSize(mContext, FontManager.TEXT_TYPE_PRIMARY));
    });

    LiveViewManager.registerView(QKPreference.BACKGROUND, this, key -> {
        setTextColor(ThemeManager.getTextOnBackgroundPrimary());
        setHintTextColor(ThemeManager.getTextOnBackgroundSecondary());
    });

    LiveViewManager.registerView(QKPreference.MOBILE_ONLY, this, key -> {
        if (mAdapter != null) {
            SharedPreferences prefs1 = mContext.getPrefs();
            mAdapter.setShowMobileOnly(prefs1.getBoolean(SettingsFragment.MOBILE_ONLY, false));
        }
    });
}
 
開發者ID:moezbhatti,項目名稱:qksms,代碼行數:35,代碼來源:AutoCompleteContactView.java


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