狂気...私が何をしようとも、私のAutoCompleteTextView
ショーはデフォルトのスタイルでアイテムをドロップダウンします。ドロップダウンビューにアクセスできないようです。XMLでスタイリングし、アダプタでコーディングし、AutoCompleteTextView自体をコーディングしてみました。
spinner_dropdown_item.xml:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000"
android:textSize="16dp"
/>
私のクライアント(LoginFragment.java
):
AutoCompleteTextView user_name = (AutoCompleteTextView) layout.findViewById(R.id.user_name);
final MyAdapter<User> adapter = new MyAdapter<User>(my_activity, my_list);
//does nothing
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
//crashes app with no error or anything!
user_name.setDropDownBackgroundResource(R.layout.spinner_dropdown_item);
user_name.setAdapter(user_adapter);
最後に、私のアダプターでは、スピナーのドロップダウンアイテムのスタイルを設定するために完全に機能していますが、AutoCompleteTextViewのドロップダウンのスタイルを設定できません。
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
TextView tv;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(context);
tv = (TextView) inflater.inflate(R.layout.spinner_dropdown_item, null);
} else {
tv = (TextView) convertView;
}
T object = objects.get(position);
String label = NULL_ITEM;
if (object != null) {
label = object.toString();
}
tv.setText(label);
return tv;
}
AutoCompleteTextViewのドロップダウンリストを変更して、ドロップダウンテキストアイテムのスタイルを変更するにはどうすればよいですか?