Android - Can't hide progress bar

后端 未结 4 979
误落风尘
误落风尘 2021-01-21 05:19

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         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-21 05:40

    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.

提交回复
热议问题