こんなレイアウトがあるとする。
include.xml
< xml version="1.0" encoding="utf-8" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:text="ラベル"
android:id="@+id/btn_include"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
JavaコードからInflatesすると、、、
LayoutInflater inflater = (LayoutInflater)getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View inflateView = inflater.inflate(R.layout.include, null);
この時、inflateViewに付与されているLayoutParamsは、nullになる。
恐らくLayoutParamsは親のViewGroupのLayoutParamsが付与されなければならないので、
Inflateされた時点で親のViewGroupは存在しないためかな?