Samjack
Samjack

Reputation: 188

Android: Insert immage button dynamically through code

i want to insert an image to do a button. But i want insert it through the code, no with the .xml file. There is someone that have any idea?

Upvotes: 0

Views: 70

Answers (1)

Subramanian Ramsundaram
Subramanian Ramsundaram

Reputation: 1347

Try This:

ImageButton ib = new ImageButton(this);
yourContainer.addView(ib);//here yourContainer is ParentLayout

Upvotes: 1

Related Questions