I'm working on an android application and I need to create a board (made of buttons).
I already generated the board from the code of my java class, but the problem is that the buttons go out of sight (they leave the screen). I have already tried several things with the LayoutParams but nothing has worked for me. I hope you can help me thanks.
Here is the code generated by the board (buttons)
botones = new Button[numLetras];
for (int i = 0; i < numLetras; i++ )
{
botones[i] = new Button(layout.getContext());
botones[i].setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
botones[i].setText(texto[i]);
botones[i].setId(i + 1 );
layout.addView(botones[i]);
}
and here is a picture of how it looks. (The text that has to appear is "TEXTEXAMPLE")