So I\'ve checked the other questions to hide a progress bar but all seem to suggest doing what I\'m already doing.
I\'m trying to use
mProductListProgres
I don't know how your code is written but had similar problem and resolved by removing the view object from declaration
like
mProductListProgressBar = (ProgressBar) mRoot.findViewById(R.id.product_list_progressbar);
should be
mProductListProgressBar = (ProgressBar) findViewById(R.id.product_list_progressbar);
Try it and check
Reason is the progress bar is on the top of every view in the hierarchy and it's not belong to any root view.
The problem with this behaviour usually happens when your view which you try to hide is needed / referenced by someone else.
In your case, as you mentioned in the comments, you use mProductListProgressBar
for setEmptyView()
of your GridView
.
Another possibility of running into similar troubles when there other views in your relative container layout which set their position relatively to your mProductListProgressBar
. This setting could be either in the code or in .xml.
Please make sure you don't have any of above and View.GONE should work fine.
As for setEmptyView() - it is only used to show something meaningful to the user when your adapter is empty. I recommend just setting up simple Layout for that with, say, TextView "no items"
, in the middle, and pass it to setEmptyView()
Hope that helps.
A solution that worked for me was to hide the view in XML:
android:visibility="gone"
and then unhide/hide it at runtime when needed:
yourProgressBar.setVisibility(View.VISIBLE) // or View.VISIBLE depending on situation
I know that it is an old question. But I just spent a lot of time debugging similar situation. I could not hide ProgressBar on top of unityPlayer view.
One more thing to ensure is that You are hiding it while in UI thread.
To ensure surround Your UI code with:
runOnUiThread(new Runnable() {
@Override
public void run() {
loadingIndicator.setVisibility(View.GONE);
}
});