3
我創建了一個TabWidgetandroid:layout_above =「@ android:id/tabs」的等效代碼是什麼?
TabWidget tabWidget = new TabWidget(this);
tabWidget.setId(android.R.id.tabs);
和FrameLayout裏
FrameLayout frameLayout = new FrameLayout(this);
frameLayout.setId(android.R.id.tabcontent);
怎麼做的FrameLayout上面的標籤?
**what is the equivalent code to "android:layout_above="@android:id/tabs"**
編輯
我對這個代碼做什麼,是不是正確的?
TabHost tabHost = new TabHost(this);
tabHost.setLayoutParams(
new RelativeLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT,1));
TabWidget tabWidget = new TabWidget(this);
tabWidget.setId(android.R.id.tabs);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(width, height);
lp.addRule(RelativeLayout.ABOVE, R.id.tabcontent);
tabWidget.setLayoutParams(lp);
tabHost.addView(tabWidget);
FrameLayout frameLayout = new FrameLayout(this);
frameLayout.setId(android.R.id.tabcontent);
frameLayout.setPadding(0, 55, 0, 0);
tabHost.addView(frameLayout, new RelativeLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
tabHost.setup();
嘿,我DONO我哪裏錯了!它不適合我!讓我更新我的代碼 – Ads 2010-11-21 09:01:18
我錯過了任何相對佈局? – Ads 2010-11-21 09:17:17
當然,你需要使用RelativeLayout ... android:layout_above特定於它如何排列其子元素。 – 2010-11-21 12:57:57