See this picture:
I am designing a sudoku in android, have done the layout like this, so 81 Editext is there. I
You can try out this way:
public static ArrayList
m_arr_edit= = new ArrayList (); RelativeLayout p_rl_layout=new RelativeLayout(m_context); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); LinearLayout m_ll_timelayout = new LinearLayout(m_context); m_ll_timelayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); for (int i = 0; i < p_intervals; i++) { EditText m_edit = new EditText(m_context); m_edit.setLayoutParams(new LinearLayout.LayoutParams(90, LayoutParams.WRAP_CONTENT)); m_edit.setText("Set Text"); m_edit.setId(i); m_arr_edit.add(m_btn); m_ll_timelayout.addView(m_btn); } layoutParams.addRule(RelativeLayout.BELOW); p_rl_layout.addView(m_ll_timelayout, layoutParams);
I hope it will help you.