android.widget.AutoCompleteTextView.setHint()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中android.widget.AutoCompleteTextView.setHint()方法的一些代码示例,展示了AutoCompleteTextView.setHint()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AutoCompleteTextView.setHint()方法的具体详情如下:
包路径:android.widget.AutoCompleteTextView
类名称:AutoCompleteTextView
方法名:setHint

AutoCompleteTextView.setHint介绍

暂无

代码示例

代码示例来源:origin: ckcz123/PKUHelper-Android

public static void resetList() {
  try {
    setHeaderView();
    SearchView searchView = (SearchView) allBoardsView.findViewById(R.id.bbs_allboards_searchview);
    AutoCompleteTextView search_text = (AutoCompleteTextView) searchView.findViewById(searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null));
    search_text.setText("");
    if (allBoards)
      search_text.setHint("搜索所有版面...");
    else
      search_text.setHint("搜索收藏版面...");
    allBoardsView.requestFocus();
  } catch (Exception e) {
  }
  getQuery("");
}

代码示例来源:origin: AmaldevTA/ChipLayout

private AutoCompleteTextView createAutoCompleteTextView(Context context) {
  final LayoutParams lparamsTextView = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
  lparamsTextView.setMargins(0, 0, 10, 0);
  lparamsTextView.gravity = Gravity.CENTER;
  final AutoCompleteTextView autoCompleteTextView = new AutoCompleteTextView(context);
  autoCompleteTextView.setBackgroundColor(Color.parseColor("#00FFFFFF"));
  autoCompleteTextView.setLayoutParams(lparamsTextView);
  autoCompleteTextView.setHint(" ");
  autoCompleteTextView.setPadding(10,0,10,10);
  autoCompleteTextView.setSingleLine(true);
  autoCompleteTextView.setTextColor(textColor);
  autoCompleteTextView.setHintTextColor(hintColor);
  autoCompleteTextView.setCursorVisible(true);
  return autoCompleteTextView;
}

代码示例来源:origin: henrichg/PhoneProfilesPlus

private void updateHint(int hintTextId, int imageDrawableId) {
  String hintText = getResources().getString(hintTextId);
  Drawable searchIcon = getResources().getDrawable(imageDrawableId);
  SpannableStringBuilder ssb = new SpannableStringBuilder("   "); // for the icon
  ssb.append(hintText);
  int textSize = (int) (mAutoCompleteTextView.getTextSize() * 1.25);
  searchIcon.setBounds(0, 0, textSize, textSize);
  ssb.setSpan(new ImageSpan(searchIcon), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  mAutoCompleteTextView.setHint(ssb);
}

代码示例来源:origin: okleine/spitfirefox

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  View view = inflater.inflate(R.layout.fragment_request, container, false);
  //register this fragment as listener to click events on the send button
  view.findViewById(R.id.btn_send).setOnClickListener(this);
  //restore previously discovered services
  if(savedInstanceState != null) {
    String[] serviceNames = savedInstanceState.getStringArray("services");
    if (serviceNames != null) {
      ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(),
          android.R.layout.simple_spinner_dropdown_item, serviceNames);
      AutoCompleteTextView txtService = ((AutoCompleteTextView) view.findViewById(R.id.txt_service));
      txtService.setAdapter(adapter);
      txtService.setHint(R.string.service_hint2);
    }
  }
  ArrayAdapter adapter = ArrayAdapter.createFromResource(this.getContext(), R.array.blocksizes,
      R.layout.spinner_item);
  adapter.setDropDownViewResource(R.layout.spinner_item);
  ((Spinner) view.findViewById(R.id.spn_block2)).setAdapter(adapter);
  ((Spinner) view.findViewById(R.id.spn_block1)).setAdapter(adapter);
  return view;
}

代码示例来源:origin: AmaldevTA/ChipLayout

public void setHint(String hint){
  hintText = hint;
  if (this.getChildCount() == 1){
    AutoCompleteTextView textView = (AutoCompleteTextView) this.getChildAt(0).findViewWithTag(autoCompleteTextViewTag);
    textView.setHint(hintText);
  }
}

代码示例来源:origin: zulip/zulip-android

/**
 * Switch from Private to Stream or vice versa in chatBox
 */
private void switchView() {
  if (isCurrentModeStream()) { //Person
    togglePrivateStreamBtn.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_action_bullhorn));
    tempStreamSave = topicActv.getText().toString();
    topicActv.setText(null);
    topicActv.setHint(R.string.hint_person);
    topicActv.setAdapter(emailActvAdapter);
    streamActv.setVisibility(View.GONE);
    textView.setVisibility(View.GONE);
  } else { //Stream
    topicActv.setText(tempStreamSave);
    togglePrivateStreamBtn.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_action_person));
    streamActv.setEnabled(true);
    topicActv.setHint(R.string.hint_subject);
    streamActv.setHint(R.string.hint_stream);
    streamActv.setVisibility(View.VISIBLE);
    textView.setVisibility(View.VISIBLE);
    topicActv.setVisibility(View.VISIBLE);
    streamActv.setAdapter(streamActvAdapter);
    topicActv.setAdapter(subjectActvAdapter);
  }
}

代码示例来源:origin: okleine/spitfirefox

((AutoCompleteTextView) activity.findViewById(R.id.txt_service));
txtService.setAdapter(adapter);
txtService.setHint(R.string.service_hint2);

代码示例来源:origin: andstatus/andstatus

private void onSearchObjectsChange() {
  searchText.setAdapter(new SuggestionsAdapter(parentActivity, getSearchObjects()));
  searchText.setHint(getSearchObjects() == SearchObjects.NOTES ? R.string.search_timeline_hint
      : R.string.search_userlist_hint );
  onSearchContextChanged();
}

代码示例来源:origin: stackoverflow.com

autoText.setHint("Οδός Αριθμός, Περιοχή");

代码示例来源:origin: hemant3370/Insta

txtUrl.setHint("Type here...");

代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android

mTbStartLocation.setHint(getResources()
    .getString(R.string.text_box_start_location_hint));
mTbEndLocation.setHint(getResources()
    .getString(R.string.text_box_end_location_hint));

代码示例来源:origin: adolfAn/FBReader_AS

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.edit_tags_dialog);
  myResource = ZLResource.resource("dialog").getResource("editTags");
  
  final Intent intent = getIntent();
  ArrayList<String> allTagsList = intent.getStringArrayListExtra(EditListDialogActivity.Key.ALL_ITEMS_LIST);
  myInputField = (AutoCompleteTextView)findViewById(R.id.edit_tags_input_field);
  myInputField.setHint(myResource.getResource("addTag").getValue());
  myInputField.setOnEditorActionListener(new TextView.OnEditorActionListener(){
    public boolean onEditorAction (TextView v, int actionId, KeyEvent event){
      if(actionId == EditorInfo.IME_ACTION_DONE){
        addTag(myInputField.getText().toString(), myEditPosition);
        myInputField.setText("");
        myEditPosition = -1;
        return false;
      }
      return true;
    }
  });
  myInputField.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, allTagsList));

  parseUIElements();        
  final TagsAdapter adapter = new TagsAdapter();
  setListAdapter(adapter);
  getListView().setOnItemClickListener(adapter);
  getListView().setOnItemLongClickListener(adapter);
  setResult(RESULT_CANCELED);
}

代码示例来源:origin: adolfAn/FBReader_AS

myInputField.setHint(myResource.getResource("addAuthor").getValue());
myInputField.setOnEditorActionListener(new TextView.OnEditorActionListener(){
  public boolean onEditorAction (TextView v, int actionId, KeyEvent event){

代码示例来源:origin: AmaldevTA/ChipLayout

autoCompleteTextView.setTag(autoCompleteTextViewTag);
if(this.getChildCount() < 1 && hintText != null){
  autoCompleteTextView.setHint(hintText);

相关文章

AutoCompleteTextView类方法