Я пытаюсь создать серию кнопок внутри LinearLayout. Поэтому у меня есть следующий кодДинамические кнопки Android внутри LinearLayout
XML
<LinearLayout
android:id="@+id/yearContainer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
в моей деятельности
LinearLayout yearContainer=(LinearLayout)findViewById(R.id.yearContainer);
for(int i=0;i<16;i++){
Button btn=new Button(this);
btn.setText("Button "+i);
btn.setId(150+i);
LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(width/3,LayoutParams.WRAP_CONTENT);
btn.setLayoutParams(params);
yearContainer.addView(btn);
}
Но Кнопки расположения вертикально. Мне нужно это как следующий шаблон.
Я новичок в Android. Пожалуйста посоветуйте
Заранее спасибо
использование TableLayout – Raghunandan