Android - ProgressBar setVisibility to GONE not working

后端 未结 5 2362
无人及你
无人及你 2021-02-20 08:59

I\'ve been adding a ProgressBar to the fragments in my app. I\'ve set it up to the two main fragments (used as tabs) as follows:

ProgressBar in

5条回答
  •  春和景丽
    2021-02-20 09:50

    Check this code:

    spinner = (ProgressBar)getActivity().findViewById(R.id.progressBar1);
    

    If you are using fragments it should be like this:

    spinner = (ProgressBar)viewIinflated.findViewById(R.id.progressBar1);//same case with dialogs
    

    If you are using activity then:

    spinner = (ProgressBar)findViewById(R.id.progressBar1);
    

提交回复
热议问题