I load the data from the server in portions and display a list. When scrolling to the bottom of the new download begins. I want at this moment to appear below the panel, on which the progressBar and the small text " loading... " would be located, I AsyncTask data using AsyncTask . Tried to call in onPreExecute() method

  proBar = (ProgressBar) findViewById(R.id.progress_bar); proBar.setVisibility(View.VISIBLE); edText = (EditText) findViewById(R.id.progress_bar_text); edText.setVisibility(View.VISIBLE); 

and switch to onPostExecute , but nothing is displayed, why?
This is what the layout looks like:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <!-- Данные списком --> <ListView android:id=" @android :id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffffff" /> 

<! - Panel with progressBar and comments ->

 <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center"> <!-- Прогресс-бар и коммент --> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center"> <ProgressBar android:id="@+id/progress_bar" style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/progress_bar_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center_horizontal" android:text="loading search engines..." android:ems="10" > </EditText> </LinearLayout> </LinearLayout> 

    1 answer 1

    1. ListView has a great property called FooterView . Code example
    2. If I want to write my own bike, I would do this:

       <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <RelativeLayout android:layout_alignParentBottom="true" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/progress_view"/> <ListView android:layout_above="@id/progress_view" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/listview"/> </RelativeLayout> 
    3. Alternatively, the adapter for ListView in the getSize () method can return one more, and in the getView () method, check the position of the element, if it is equal to the last one, then infiteit the view with progress, if not, the normal view

    UPDATE

    For your case, here is the working code.

     <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ListView android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <LinearLayout android:background="#aaa" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_weight="0"> <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="text_text_text"/> </LinearLayout> </LinearLayout> 
    • most likely it will be enough for you in LinearLayout, which comes right after the ListView, to add the property layout_height = 1 or 0, one of this will help - Roman Zakharov
    • I did it, but I don’t see the effect of scrolling, but progressBar is not visible .. - Stas0n
    • Added a working code to your reply - Roman Zakharov
    • @Roman Zakharov, How can we make a small text message next to each other? Here I added next to the progressBar TextView, and the sense of 0 - Stas0n
    • Updated his answer for TextView - Roman Zakharov