title: ProgressBar programmatically in Fragment
body: <p>I have a TabWidget with some Fragment in it. I want to show a ProgressBar inside it but the ProgressBar never show. Here my code: </p>
  
  <pre><code>private ProgressBar progressBar;
  
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
      View view = inflater.inflate(R.layout.roomstatusadmin_activity, container, false);
  
      progressBar = new ProgressBar(getActivity().getApplicationContext(), null, android.R.attr.progressBarStyleSmall);
      progressBar.setIndeterminate(true);
      progressBar.setVisibility(View.VISIBLE);
      //FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
      //layoutParams.gravity = Gravity.CENTER;
      RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
      layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
      progressBar.setLayoutParams(layoutParams);
  
      return view;
  }
  </code></pre>
  
  <p>I read some question but there is no solution, like <a href="https://stackoverflow.com/questions/40699680/add-a-progressbar-programatically-to-a-fragment-in-android">this</a> . I test with add the ProgressBar into my layout.xml and the ProgressBar is show. But I will have use this ProgressBar in some layout so I realy need it programmatically.</p>