I have a view with EditText
, Button
and ListView
.
Button's onClick()
parses some site (this part works OK), but it takes some time to display the parsed info in ListView
, so I want to display small ProgressBar
on the place, where the ListView
should take place after a while.
So, I add this to my layout (I write important part here):
<RelativeLayout 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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/layout1"
android:weightSum="1.0">
<EditText
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight=".86" />
<ImageButton
android:layout_height="match_parent"
android:layout_width="0px"
android:layout_weight=".14" />
</LinearLayout>
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_below="@id/layout1"
android:gravity="center"
android:layout_centerInParent="true"
android:id="@+id/progressbar" >
<ProgressBar
android:layout_height="wrap_content"
android:layout_width="wrap_content"
style="@android:style/Widget.ProgressBar.Small" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/layout1">
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
</RelativeLayout>
In source code:
progressBar = (RelativeLayout) findViewById(R.id.progressbar);
And everytime I want to show the ProgressBar
, I do this:
progressBar.setVisibility(View.VISIBLE);
for disabling:
progressBar.setVisibility(View.INVISIBLE);
But this doesn't work.
How can I work this out?