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

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

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

AutoCompleteTextView.showDropDown介绍

暂无

代码示例

代码示例来源:origin: rey5137/material

/**
 * <p>Displays the drop down on screen.</p>
 * <p>Only work when autoComplete mode is {@link #AUTOCOMPLETE_MODE_SINGLE} or {@link #AUTOCOMPLETE_MODE_MULTI}</p>
 */
public void showDropDown() {
  if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE)
    return;
  ((AutoCompleteTextView)mInputView).showDropDown();
}

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

AutoCompleteTextView text;
.....
.....
text.setOnTouchListener(new View.OnTouchListener(){
  @Override
  public boolean onTouch(View v, MotionEvent event){
   text.showDropDown();
   return false;
  }
});

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

final AutoCompleteTextView textView;
 final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(
     getActivity(), android.R.layout.simple_dropdown_item_1line,
     getResources().getStringArray(R.array.names));
 textView = (AutoCompleteTextView) v.findViewById(R.id.txtViewNames);
 textView.setAdapter(arrayAdapter);
 textView.setOnClickListener(new View.OnClickListener() {
   @Override
   public void onClick(final View arg0) {
     textView.showDropDown();
   }
 });

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

AutoCompleteTextView autoComplete;
String savedText;

public void showAll() {
  savedText = autoComplete.getText().toString();
  autoComplete.setText("");
  autoComplete.showDropDown();
}

public void restore() {
  autoComplete.setText(savedText);
}

代码示例来源:origin: kaytat/SimpleProtocolPlayer

@Override
  public boolean onTouch(View v, MotionEvent event) {
    mIPAddrText.showDropDown();
    return false;
  }
});

代码示例来源:origin: kaytat/SimpleProtocolPlayer

@Override
  public boolean onTouch(View v, MotionEvent event) {
    mAudioPortText.showDropDown();
    return false;
  }
});

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

final AutoCompleteTextView mAutoCompleteTextView;
 final ArrayAdapter<String> mAdapter = new ArrayAdapter<String>(
     getActivity(), android.R.layout.simple_dropdown_item_1line,
     getResources().getStringArray(R.array.items));
 mAutoCompleteTextView = (AutoCompleteTextView) view.findViewById(R.id.name_txt);
 mAutoCompleteTextView.setAdapter(mAdapter);
 mAutoCompleteTextView.setOnClickListener(new View.OnClickListener() {
   @Override
   public void onClick(final View arg0) {
     mAutoCompleteTextView.showDropDown();
   }
 });

代码示例来源:origin: kaytat/SimpleProtocolPlayer

@Override
  public void onFocusChange(View v, boolean hasFocus) {
    if (hasFocus && mIPAddrText.getAdapter() != null)
      mAudioPortText.showDropDown();
  }
});

代码示例来源:origin: WowzaMediaSystems/gocoder-sdk-samples-android

@Override
  public void onClick(View view) {
    if (((AutoCompleteTextView)view).getText().length() == 0)
      mAutoCompleteEditText.showDropDown();
  }
});

代码示例来源:origin: tananaev/rootless-logcat

@Override
  public void onClick(View v) {
    if (autoCompleteTextView.length() == 0) {
      autoCompleteTextView.showDropDown();
    }
  }
});

代码示例来源:origin: kaytat/SimpleProtocolPlayer

@Override
  public void onFocusChange(View v, boolean hasFocus) {
    if (hasFocus && mIPAddrText.getAdapter() != null)
      mIPAddrText.showDropDown();
  }
});

代码示例来源:origin: WowzaMediaSystems/gocoder-sdk-samples-android

@Override
  public void onFocusChange(View view, boolean focused) {
    if (focused && mAutoCompleteEditText != null && mAutoCompleteEditText.getAdapter().getCount() > 0)
      mAutoCompleteEditText.showDropDown();
  }
});

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

AutoCompleteTextView inputSearch=(AutoCompleteTextView) view.findViewById(R.id.inputSearch);
 products = new String[]{"Product1","product2","product3"}; 
 inputSearch.setAdapter(new ArrayAdapter<String>(getActivity(),R.layout.listitem,products));
 inputSearch.setThreshold(1);
 inputSearch.setOnClickListener(new OnClickListener() {
   @Override
   public void onClick(View v) {
     inputSearch.showDropDown();
   }
 });
 inputSearch.setOnItemClickListener(new OnItemClickListener(){
   @Override
   public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) {
   //Do whatever you want with selected object
   }
  }

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

@Override
  public void onFocusChange(View view, boolean focused) {
    String countryEntered = mCountryAutocomplete.getText().toString();
    if (focused) {
      mCountryAutocomplete.showDropDown();
    } else {
      updateUIForCountryEntered(countryEntered);
    }
  }
});

代码示例来源:origin: sytolk/TaxiAndroidOpen

@FocusChange(R.id.regionsPicker)
void regionsPicker(View view, boolean hasFocus) {
  Log.i(TAG, "FocusChange regionsPicker:" + hasFocus);
  if (hasFocus && isVisible() && regionsPicker != null)
    regionsPicker.showDropDown();
}

代码示例来源:origin: sytolk/TaxiAndroidOpen

@FocusChange(R.id.citiesPicker)
void citiesPicker(View view, boolean hasFocus) {
  if (isVisible() && citiesPicker != null) {
    if (hasFocus) citiesPicker.showDropDown();
    //else cityChanged(citiesPicker.getText().toString());
  }
}

代码示例来源:origin: openmrs/openmrs-contrib-android-client

@Override
  public void onFocusChange(View v, boolean hasFocus) {
    if (edcountry.getText().length() >= edcountry.getThreshold()) {
      edcountry.showDropDown();
    }
    if (Arrays.asList(countries).contains(edcountry.getText().toString())) {
      edcountry.dismissDropDown();
    }
  }
});

代码示例来源:origin: sytolk/TaxiAndroidOpen

@Click(R.id.citiesPicker)
void citiesPickerClick() {
  if (isVisible() && citiesPicker != null)
    citiesPicker.showDropDown();
}

代码示例来源:origin: sytolk/TaxiAndroidOpen

@Click(R.id.regionsPicker)
void regionsPickerClick() {
  if (isVisible() && regionsPicker != null)
    regionsPicker.showDropDown();
}

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

private AutoCompleteTextView mAutoText;

 mAutoText.setOnTouchListener(new OnTouchListener() {
      @Override
      public boolean onTouch(View v, MotionEvent event) {
        mAutoText.showDropDown();
        mAutoText.setListSelection(mPos);
        return false;
      }

    });
mAutoText.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
      mAdapter.setSelection(position);
      mPos = position;

    }
  });

相关文章

AutoCompleteTextView类方法