2
我已經安裝了API Level 10 SDK(又名2.3.3)。放置在FrameLayout中的按鈕在2.3.6設備中無法正常工作,即使編譯自2.3.3(API 10)SDK
我已經在FrameLayout上編程添加了一個簡單的按鈕線性排列。
minTargetVersion = 「8」 maxTargetVersion = 「10」
正確ICS 4.0.4設備上運行。 在模擬器上正常運行。 但是,當我在OS 2.3.5或2.3.6的設備上安裝apk時,按鈕不遵守左邊距參數,並且所有按鈕都會在另一個上出現。
我已經看到FrameLayout是在API級別1中引入的,而運行的設備在API級別10或更高級別上,這應該不成問題。
添加一個按鈕
Button b1 = new Button(this);
FrameLayout frameLayout = (FrameLayout)this.findViewById(R.id.mainActivityView);
FrameLayout.LayoutParams params = FrameLayout.LayoutParams(100,100); //a 100x100 button
params.leftMargin = 10; // in other buttons, this values is incremented as 100, 200
params.topMargin = 10;
frameLayout.addView(b1,params);
任何人都可以讓我知道這可能是造成這種不當行爲的我的示例代碼?