LinearLayout
ürününe birden çok Görünüm eklemek istiyorum. İşte ben LinearLayout
için çoklu görünüm ekleme eklemek için kullanıyorum kod.Linearlayout'a dinamik olarak görünüm ekleme sorunu
Java kodu: Burada
LinearLayout seriesMainListItemView = (LinearLayout) findViewById(R.id.SeriesMainListItemView);
LayoutInflater mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for (int i=0; i<scheduleArr.length; i++) {
View inflatedView = mInflater.inflate(R.layout.scheduleitem, null);
TextView inflatertext1 = (TextView) inflatedView.findViewById(R.id.text1);
TextView inflatertext2 = (TextView) inflatedView.findViewById(R.id.text2);
inflatertext1.setText(scheduleArr[i][0]);
inflatertext2.setText(scheduleArr[i][1]);
Log.i("data",i + " " + scheduleArr[i][0] + "/" + scheduleArr[i][1]);
seriesMainListItemView.addView(inflatedView);
}
Ben birden çok kez eklemek istediğiniz Görünüm xml olduğunu.
İşte bunu eklemek istediğiniz LinearLayout olduğunu.
<TableLayout
android:layout_gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="1dip"
android:paddingRight="1dip" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/imgSeriesMainScheduleImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/scheduleheader"/>
<LinearLayout
android:id="@+id/SeriesMainListItemView"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</LinearLayout>
</TableRow>
..............
</TableLayout>
Ama dizinin uzunluğu 3. benim kodunda sorunu nedir rağmen sadece tek görünüm, LinearLayout içinde ekliyor?
LinearLayout öğesinin yönünü ayarladınız mı? – Sujit
Hiçbir yön ayarlanmadı. –