Answer the question
In order to leave comments, you need to log in
Why in custom AutoCompleteTextView onClick only works after getting focus?
I create a custom AutoCompleteTextView, when clicked, it opens all available options, like an ExpandableListView.
public class CustomAutoCompleteTextView extends AutoCompleteTextView implements View.OnClickListener, View.OnFocusChangeListener {
public CustomAutoCompleteTextView(Context context) {
super(context);
setOnClickListener(this);
setOnFocusChangeListener(this);
}
public CustomAutoCompleteTextView(Context context, AttributeSet attrs) {
super(context, attrs);
setOnClickListener(this);
setOnFocusChangeListener(this);
}
public CustomAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setOnClickListener(this);
setOnFocusChangeListener(this);
}
@Override
public void onClick(View view) {
this.showDropDown();
}
@Override
public void onFocusChange(View view, boolean b) {
if(b)
{
this.showDropDown();
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question