java - How do I make my buttons fit on screen in Android? -
i have method takes string of text, chops , makes buttons out of words in string. add these horizontal linear layout this:
for (int x = 0; < string.length; x++) { button word = new button(context); word.settext(string[x]+""); mylinearlayout.addview(word); } the problem if string long, buttons go off screen. how make buttons appear on line below instead of jumping off screen? i've been looking solution day couldn't find answer.
thanks!
try this..
(int x = 0; < string.length; x++) { button word = new button(context); word.settext(string[x]+""); linearlayout.layoutparams left_on = new linearlayout.layoutparams(0, linearlayout.layoutparams.wrap_content,1); word.setlayoutparams(left_on); mylinearlayout.addview(word); }
Comments
Post a Comment