我無法使用WebView始終填充整個屏幕,因此覆蓋了我的選項卡。這裏是我的tabhost代碼..WebView內部Tab隱藏TabWidgets
public class tabNZBMobile extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Reusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, NewzbinMobile.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("search").setIndicator("Search",
res.getDrawable(R.drawable.ic_tab_search))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, sabnzbWeb.class);
spec = tabHost.newTabSpec("sabnzbweb").setIndicator("SabNZBd",
res.getDrawable(R.drawable.ic_tab_sabnzbweb))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTabByTag("search");
}}
我的第一個選項卡(NewzbinMobile.class)顯示正確,它只是一個RelativeLayout的。但我的第二個標籤是一個顯示webview的活動,它正在顯示,但使用整個屏幕覆蓋我的標籤。這是我的第二個選項卡的代碼。
public class sabnzbWeb extends Activity {
WebView mWebView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String sabNZBurl = new String("http://test.server.org:8080/m");
mWebView = new WebView(this);
mWebView.getSettings().setJavaScriptEnabled(true);
setContentView(mWebView);
mWebView.loadUrl(sabNZBurl);
}}