現在、アプリにオートコンプリートのドロップダウンボックスがありますが、フォントの色が一種の灰色であり、リストにデータが入力されているときは表示されないようです。2番目の図は、クリックしたときにドロップダウンがどのように表示されるかを示しています。ドロップダウンのレイアウトを変更して、リスト内のアイテムを黒などの別の色で表示するにはどうすればよいですか?
下の写真!
編集
AlertDialog.Builder adb = new AlertDialog.Builder(SettingsMain.this);
LayoutInflater inflater = SettingsMain.this.getLayoutInflater();
final View searchlayout = inflater.inflate(R.layout.search_friend, null);
friend_name = (AutoCompleteTextView) searchlayout.findViewById(R.id.friend_name);
friend_name.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable editable) {
}
public void beforeTextChanged(CharSequence charSequence, int arg1, int arg2, int arg3) {
}
public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
String text = charSequence.toString();
new MyAsyncTask("get").execute("http://10.0.2.2/jamtivia/webservice.php?type=get_friends&username="+text);
drop_down_adapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_dropdown_item_1line,adapterList);
drop_down_adapter.notifyDataSetChanged();
friend_name.setAdapter(drop_down_adapter);
if (!friend_name.isPopupShowing()) {
friend_name.showDropDown();
}
for(int i =0;i < adapterList.size();i++)
Log.d("TEXT CHNGE", adapterList.get(i));
}
});
adb.setView(searchlayout)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String fname = friend_name.getText().toString();
Integer friend_id = null;
try{
friend_id = adapterListId.get(adapterList.indexOf(fname));
Log.d( "ECHO" , "text : " + name +"ID :"+ player_id+ " ID: " + friend_id);
String request = "http://10.0.2.2/jamtivia/webservice.php?type=add_friends&friendId="+friend_id+"&playerId="+player_id;
new MyAsyncTask("send").execute(request);
}catch(Exception e){Log.d( "PROBLEM SENDING" , "text : " + adapterList.indexOf(fname));}
return;
}
})
.setNegativeButton("Done", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
adb.show();
また、このコードスニペットでわかる限り、これはこの関数を実行するための良い方法ですか?