Android: Button Creation in Row

arashiimaru

New Member
Its create dynamic button in a single row\[code\] final LinearLayout layoutshape = (LinearLayout) findViewById(R.id.linearshape); a = new Button[10]; for (int i = 0; i < 10; i++) { a = new Button(this); a.setText(""+i); a.setId(i); a.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); a.setBackgroundResource(R.drawable.background); layoutshape.addView(a); }\[/code\]but I wanna make this to be split in to three rows. Eg: If I've 30 buttons then its should be displayed in 10 button in 1st row then next10 in second row and 10 in third rowo/p buttons as to be:b1 b2 b3 b4 b5 b6 b7 b8 b9 b10b11 b12 b13 b14 b15
 
Back
Top