カテゴリごとに動的に別のレイアウトで膨らませるレイアウトがあります。
LinearLayout l = (LinearLayout) findViewById(R.id.container);
for (CategoryEB e :categoryList){
LayoutInflater layoutInflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout linLayout = (LinearLayout)layoutInflater.inflate(R.layout.inflated_layout, l);
TextView view = (TextView)linLayout.findViewById(R.id.lable);
view.setText(e.getName());
}
これは、拡張されるxml(inflated_layout.xml)です。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="wrap_content" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:id="@+id/lable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="xxx"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="6dip"/>
</LinearLayout>
ただし、この方法では、最初のアイテムのみに正しい値が入力されます。categoryListの他のものはxxxとして表示されます(xmlで説明されています)。
リストに正しい名前をすべて表示するにはどうすればよいですか?