나는 이름이 들어있는 AutoCompleteTextView
을 가지고있는 간단한 어플리케이션을 만들고 있습니다. ImageView
을 AutoCompleteTextView의 마지막 항목 끝에 넣고 싶습니다. 클릭 할 수 없거나 선택 가능하지 않아야합니다.autocompletetextview에서 마지막 항목을 선택하는 것을 피하는 방법
마지막 목록 항목 다음에 ImageView
표시와 함께 목록을 채울 수 있지만 그 중 CLICKABLE/SELECTABLE을 선택할 수 없습니다. 즉, &의 EMPTY 필드를 BLANK/EMPTY로 설정합니다. 해당 뷰에 onTouchListener
을 설정하고 onTouch()
에 아무것도 할 수
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view;
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (position != (resultList.size() - 1))
view = inflater.inflate(R.layout.autocomplete_list_item, null);
else
view = inflater.inflate(R.layout.autocomplete_google_logo, null);
if (position != (resultList.size() - 1)) {
TextView autocompleteTextView = (TextView) view.findViewById(R.id.autocompleteText);
autocompleteTextView.setText(resultList.get(position).getCityDescription());
}
else {
RelativeLayout imageView = (RelativeLayout) view.findViewById(R.id.rlTop);
imageView.setClickable(false);
imageView.setEnabled(false);
}
return view;
}
https://developer.android.com/reference/android/widget/ListAdapter.html#areAllItemsEnabled() + https://developer.android.com/reference/android/widget/ListAdapter.html# isEnabled (int) – Selvin
@Selvin 이미 isEnabled() 메소드를 오버라이드 (override)하고 있습니다 만, 사용 방법을 모릅니다. – VVB
areAllItemsEnabled가 false를 반환하면 자동으로 사용되어야합니다. – Selvin