title: What should I pass for root when inflating a layout to use for a MenuItem's ActionView?
body: <p>I have an <code>ImageView</code> that I attach to a <code>MenuItem</code> as its <code>ActionView</code> (the item appears in the <code>ActionBar</code>). The layout for this view comes from XML. I'm inflating it like so:</p>
  
  <pre><code>ImageView actionView = (ImageView) layoutInflater.inflate(
     R.layout.action_view_layout, null);
  </code></pre>
  
  <p>This appears to work fine. However; passing null for <code>root</code> in the call to <code>inflate()</code> makes Lint yell at me:</p>
  
  <blockquote>
    <p>Avoid passing null as the view root (need to resolve layout
    parameters on the inflated layout's root element)</p>
  </blockquote>
  
  <p>I can seemingly manage without a root in my specific case, but I'd rather have the code be as correct as possible. The problem is, I'm not sure which <code>View</code> should be used as the root here. <a href="https://stackoverflow.com/a/22615080/3549027">This answer</a> says it should be "the widget that is surrounding the view objects that you want to inflate." But what does that mean here? The one for the action bar? The activity? Something else entirely?</p>
  
  <hr>
  
  <p>Update: Reading the answers has made me suspect me the right thing to do is:</p>
  
  <ol>
  <li>Get the <code>ActionBar</code> <code>View</code> corresponding to the <code>MenuItem</code></li>
  <li>Get its root</li>
  <li>Cast the root to a <code>ViewGroup</code></li>
  <li>Pass the result to the inflater</li>
  </ol>
  
  <p>This seems to work. Can anyone confirm or deny whether this is what should be done?</p>