This week's book giveaway is in the Go forum.
We're giving away four copies of Head First Go and have Jay McGavren on-line!
See this thread for details.
Win a copy of Head First Go this week in the Go forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Create buttons and layout dynamically  RSS feed

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

My requirement is creating buttons dynamically.

I want to create buttons dynamically like

Button1  Button2   Button3   Button4

Button5  Button6   Button7   Button8

Button9  Button10  Button11 Button12

Button13 Button14 Button15 Button16


But only first line is displayed.

Button1  Button2  Button3  Button4

remaining buttons are not visible on screen.
Please check the attached screen shot.

My approach is :

Create a parent lay out using XML.

Create a child layout dynamically.
Create four buttons dynamically and add to child layout.
Add child layout to parent layout.

Please find the below code and please help to check what is the exact issue.





MyGame.png
[Thumbnail for MyGame.png]
 
Saloon Keeper
Posts: 20514
115
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that you have to set their "visible" attribute.
 
mohana krishna
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim Holloway,

Thanks for your reply.
I tried setting visibility to buttons and layouts but still the same issue.
Please find the below updated code.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!