title: Click Listener on the Whole Layout
body: <p>I've an activity and inside it a list fragment. In case I receive no elements for the list i'd like to add an onclick listener on the whole layout to retry the request.
  Activity layout <strong>relative_browse</strong>:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/relative_browse"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Then inside the onCreateView of the fragment i inflate <strong>fragment_list_categoriers.xml</strong>:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/fragment_list_categories"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
      &lt;ListView
          android:id="@id/android:list"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:divider="@color/gray"
          android:dividerHeight="1dp"
          android:listSelector="@android:color/transparent" &gt;
      &lt;/ListView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I tried to add the onclick listener on the empty list inside onActivityCreated, but it doesn't work:</p>
  
  <pre><code>@Override
  public void onActivityCreated(Bundle savedInstanceState) {
  
      super.onActivityCreated(savedInstanceState);
      View view  = container.findViewById(R.id.fragment_list_categories);
      view.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Log.w("DEBUG", "Click!");
          }
      });
  
  }
  </code></pre>
  
  <p>In particular I've no "Click" log, except for a tiny border of the screen on the left (it's like if the fragment_list_categories cover all the screen except some pixels).
  What's the right way to do this?</p>
  
  <p>EDIT: here my <strong>onCreateView</strong> and onClick method</p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
  
      this.inflater = inflater;
  
      View view = inflater.inflate(R.layout.fragment_list_categories,
              container, false);
  
      this.container = (ViewGroup) view;
  
      view.setOnClickListener(this);
  
      return view;
  }
  
  
  @Override
  public void onClick(View v) {
      Log.d("DEBUG", "Click!");
  }
  </code></pre>