In my XML layout for an activity, I’ve got two views which are essentially the “loading” view and the “results” view. The loading view is visible and the results are invisible until an asynchronous/threaded call completes, at which point the visibilities are intended to reverse.
Here is an excerpt of the relevant XML:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center">
<TextView
android:id="@+id/loading"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:text="@string/loading" />
<LinearLayout
android:id="@+id/results"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:visibility="invisible">
<!-- result contents -->
</LinearLayout>
</LinearLayout>
Here is the code I’m using to swap visibilities:
findViewById(R.id.results).setVisibility(View.VISIBLE);
findViewById(R.id.loading).setVisibility(View.INVISIBLE);
Unfortunately, the result of these calls appears to hide the loading view, but not show the results.
I’m thinking that even though the loading view is invisible, its area is still consuming the portion of the screen needed for the results layout to be displayed, but that’s just a guess. Any help would be appreciated!
Please use