本文整理匯總了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);
}
示例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);
}
}
示例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());
}
}
示例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));
}
示例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;
}
}
示例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;
}
示例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());
}
}
示例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;
}
示例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);
}
}
示例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);
}
示例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));
}
示例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;
}
示例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();
}
});
}
示例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, ""));
}
}
示例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));
}
});
}