Java 类android.support.v7.widget.AppCompatMultiAutoCompleteTextView 实例源码
项目:Uoccin
文件:Title.java
public void editTags(Activity activity) {
final LayoutInflater inflater = activity.getLayoutInflater();
final View view = inflater.inflate(R.layout.dialog_tags, null);
final AppCompatMultiAutoCompleteTextView edt = (AppCompatMultiAutoCompleteTextView) view.getRootView();
final AlertDialog dlg_tags = new AlertDialog.Builder(activity).setTitle(R.string.tagact_title)
.setView(view).setCancelable(true).setNegativeButton(R.string.dlg_btn_cancel, null)
.setPositiveButton(R.string.dlg_btn_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setTags(edt.getText().toString().split(",\\s*"));
}
}).create();
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(activity.getApplicationContext(),
android.R.layout.simple_dropdown_item_1line, session.getAllTags());
edt.setAdapter(adapter);
edt.setTokenizer(new AppCompatMultiAutoCompleteTextView.CommaTokenizer());
edt.setThreshold(1);
edt.setDropDownBackgroundResource(R.color.textColorNormal);
edt.setText(TextUtils.join(", ", tags));
edt.setHint(R.string.tagact_hint);
dlg_tags.show();
}
项目:CodeColors
文件:AppCompatDefStyleHandler.java
@SuppressLint({"PrivateResource", "InlinedApi"})
@Override
protected int getDefaultViewDefStyleAttr(View view) {
if (view instanceof AppCompatRadioButton) {
return R.attr.radioButtonStyle;
} else if (view instanceof AppCompatCheckBox) {
return R.attr.checkboxStyle;
} else if (view instanceof AppCompatButton) {
return R.attr.buttonStyle;
} else if (view instanceof AppCompatMultiAutoCompleteTextView) {
return R.attr.autoCompleteTextViewStyle;
} else if (view instanceof AppCompatAutoCompleteTextView) {
return R.attr.autoCompleteTextViewStyle;
} else if (view instanceof AppCompatEditText) {
return R.attr.editTextStyle;
} else if (view instanceof AppCompatCheckedTextView) {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ?
android.R.attr.checkedTextViewStyle : 0;
} else if (view instanceof AppCompatTextView) {
return android.R.attr.textViewStyle;
} else if (view instanceof AppCompatSpinner) {
return R.attr.spinnerStyle;
} else if (view instanceof AppCompatImageButton) {
return R.attr.imageButtonStyle;
} else if (view instanceof AppCompatRatingBar) {
return R.attr.ratingBarStyle;
} else if (view instanceof AppCompatSeekBar) {
return R.attr.seekBarStyle;
} else {
return super.getDefaultViewDefStyleAttr(view);
}
}