This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization 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
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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: 20643
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • 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.

 
Happily living in the valley of the dried frogs with a few tiny ads.
ScroogeXHTML - the small and fast RTF to HTML converter library
https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!