当前位置: 首页>>代码示例>>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;未经允许,请勿转载。