Tôi điền vào AutoCompleteTextView của tôi với dữ liệu nhận được từ một máy chủ web. Trong đó mất 3-5 giây. Nếu nó không chỉ ra rằng một AutoComplete của nó không ai chờ đợi. Do đó tôi muốn hiển thị một chỉ báo như thế này:Đang tải chỉ báo ở bên phải trong một AutoCompleteTextView
Tôi cố gắng này:
private class getAutoCompletes extends AsyncTask<String, Void, String> {
private String response;
@Override
protected String doInBackground(String... params) {
//get autocomplete data
return response;
}
@Override
protected void onPostExecute(String result) {
autoComplete.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
ArrayAdapter<String> AutoCompleteAdapter = new ArrayAdapter<String>(
MainActivity.this,
android.R.layout.simple_dropdown_item_1line, autocompletes);
autoComplete.setAdapter(AutoCompleteAdapter);
autoComplete.showDropDown();
}
@Override
protected void onPreExecute() {
super.onPreExecute();
autoComplete.setCompoundDrawablesWithIntrinsicBounds(0, 0,
R.drawable.rotating_drawable, 0);
}
}
R.drawable.rotating_drawable
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/spinner1"
android:duration="50"/>
<item
android:drawable="@drawable/spinner2"
android:duration="50"/>
<item
android:drawable="@drawable/spinner3"
android:duration="50"/>
<item
android:drawable="@drawable/spinner4"
android:duration="50"/>
</animation-list>
Nhưng điều này didn' t làm việc. Các drawable phải là văn phòng phẩm.
Cũng là hình ảnh loại trên của một bố cục có một tìm kiếm ImageView
, AutoCompleteTextView
, ProgressBar
và đi Button
tất cả trong một không biên giới loại nền? Vì vậy, rằng progressbar
trông giống như bên trong số AutoCompleteTextView
.
Cảm ơn bạn.