LayoutInflaterでinflate()を使っていたら、こんなエラーが出てちょっとハマってしまったのでメモ。
API referenceをみると、
http://developer.android.com/reference/android/view/LayoutInflater.html#inflate%28int,%20android.view.ViewGroup,%20boolean%29
attachToRoot Whether the inflated hierarchy should be attached to the root parameter? If false, root is only used to create the correct subclass of LayoutParams for the root view in the XML.
とある。
引数省略版は「falseなんだろうなぁ」と勝手に思いこんでいたのだけど、どうやらtrueらしい。なので、前述のエラーで困っている場合は、falseにすると解決するかも。