How to set Root View when using inflate method of LayoutInflater?
<p>After i looking up <a href="https://developer.android.com/reference/android/view/LayoutInflater.html#inflate%28int,%20android.view.ViewGroup,%20boolean%29" rel="nofollow">inflate</a>, i found it quit hard to understand what does the root view mean. Is it just the parent view of this generated xml hierarchy or the uppest view of the whole view hierarchy.<br></p>

<p>I think the answer most probably be the former. But I am facing a problem. If in the case that i can't get the parent view of this generated hierarchy, do i have to set the layout parameter everytime i inflate a hierarchy tree?<br></p>

<p>Here is my code. And the LinearLayout can't fill the parent. I think the <code>layout_height</code> and <code>layout_width</code> of the LinearLayout must be set to <code>wrap_content</code>.<br></p>

<p>storage_status.xml<br></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;com.android.contacts.StorageStatusView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_width="match_parent"&gt;

    &lt;View
        android:layout_height="50px"
        android:layout_width="50px"
        android:background="#f00"/&gt;

&lt;/com.android.contacts.StorageStatusView&gt;
</code></pre>

<p>Snippets in java file.</p>

<pre><code>private class QuickActionClickListener implements QuickAction.OnActionItemClickListener {

    @Override
    public void onItemClick(QuickAction source, int pos, int actionId) {
        switch (actionId) {
            case ACTION_ID_STORAGE_STATUS :
                final LayoutInflater inflater = getLayoutInflater();
                new AlertDialog.Builder(ContactsListActivity.this)
                        .setTitle(UIUtils.getString(ContactsListActivity.this, R.string.storage_status))
                        .setView(inflater.inflate(R.layout.storage_status, null))
                        .show();

                break; 
        }
    }
}
</code></pre>

<p>Thanks in advance. And sorry for my poor english.</p>
