2013-07-22 6 views
6

में दाहिने ओर संकेतक लोड हो रहा है मैं अपने ऑटोकंपलेटटेक्स्टव्यू को वेब सर्वर से प्राप्त डेटा के साथ पॉप्युलेट करता हूं। जो 3-5 सेकंड लेता है। अगर यह संकेत नहीं दिया गया है कि यह एक स्वत: पूर्ण नहीं है।एक ऑटोकंपलेटटेक्स्टव्यू

enter image description here

मैं इस कोशिश की:

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> 

लेकिन इस 'नहीं था इसलिए मैं इस तरह एक संकेतक दिखाना चाहते हैं टी काम नहीं सही ड्राइटेबल स्थिर है।

इसके अलावा एक खोज ImageView, AutoCompleteTextView, ProgressBar और एक Button सब जाना एक कोई सीमाओं पृष्ठभूमि के वस्तु के रूप में होने के एक लेआउट के ऊपर छवि प्रकार है? तो, progressbarAutoCompleteTextView के अंदर दिखता है।

धन्यवाद।

उत्तर

0

आप प्रगति सलाखों का उपयोग स्पिनरों को नहीं करना चाहते हैं। अपने AutoCompleteTextView फ़ील्ड पर रखने के लिए ग्राफ़िकल दृश्य का उपयोग करें और अपनी आईडी सेट करें। मैंने प्रगति लोडिंग के लिए मेरा सेट किया।

<ProgressBar 
    android:id="@+id/progressLoading" 
    style="?android:attr/progressBarStyleSmall" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignRight="@+id/autoCompleteTextViewId" 
    android:layout_alignTop="@+id/autoCompleteTextViewId" 
    android:paddingTop="14dip" 
    android:paddingRight="10dip" /> 
अपनी गतिविधि/टुकड़ा में

तब:

final ProgressBar barProgress = (ProgressBar) findViewById(R.id.progressLoading); 
originProgress.setVisibility(View.GONE); 

यह स्वचालित रूप से दिखाई दे इसलिए हमने शुरुआत में यह छिपा को तैयार है। इसके बाद हम इसे AutoCompleteTextView पर अपने addTextChangedListener पर विज़िबल पर सेट कर देते हैं। फिर जब भी वह कार्य पूरा हो जाता है तो आप इसे वापस छिपाने के लिए सेट करते हैं।

संबंधित मुद्दे