2013-11-28 24 views

回答

1

試試這個:

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

你的「容器」將是一個佈局,例如LinearLayout中,這反過來又繼承的ViewGroup此方法。在這裏查找文檔:http://developer.android.com/reference/android/view/ViewGroup.html#addView%28android.view.View%29 – bgse

+0

我該如何將圖像添加到圖像按鈕? –