我試圖做一個新的Relativelayout,然後我創建了一個按鈕,最後我將這個按鈕添加到佈局。 但「setContentView」有助於實現什麼?什麼「setContentView」幫助
下面是代碼
RelativeLayout wassimLayout = new RelativeLayout(this);
Button redButton = new Button(this);
wassimLayout.addView(redButton);
setContentView(wassimLayout);
我不知道,但我覺得它可能是設置按鈕高度,寬度等特性爲默認值。我如何防止這種情況?
感謝
你能解釋你遇到的問題嗎? 'setContentView()'擴大了該活動的佈局 – codeMagic 2015-03-30 19:09:41