title: Fragment onClickListener Not registering Click
body: <p>I've gone through all the search results on SO and I can't find one that solves my issue. I have a fragment and I am trying to use an ImageButton to close the fragment. But my onClickListener will not register a click. I placed a break-point on the line and it was never hit.</p>
  
  <pre><code>ImageButton closeButton;
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      View rootView;
      if (getArguments().getBoolean("invert") == true) {
          rootView = inflater.inflate(R.layout.popup_inverted_header_and_text, container, false);
      }else {
          rootView = inflater.inflate(R.layout.popup_header_and_text, container, false);
      }
      rootView.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
      closeButton = (ImageButton) rootView.findViewById(R.id.closeButton);
      closeButton.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              getActivity().getFragmentManager().popBackStackImmediate();
          }
      });
      return rootView;
  }
  </code></pre>
  
  <p>From my research, the way you add a fragment to a view could affect this, so here is the code where I add the fragment.</p>
  
  <pre><code>FragmentManager fragmentManager = getFragmentManager();
      headerAndTextFragment hatf = headerAndTextFragment
              .newInstance("Information on GlassFrogg review process",
                          "Here is some information about the review process that you probably didn't actually want to know",
                          true);
      FragmentTransaction transaction = fragmentManager.beginTransaction();
      transaction.replace(R.id.popupContainer, hatf);
      transaction.addToBackStack(null).commit();
  </code></pre>