其實我已經創建了一個標籤主機..現在,當我設置每個標籤的背景爲半透明比每一個標籤之間出現一條黑線..我發送我的代碼和快照來證明我answer..so請人建議我我如何才能解決這些問題的XML問題在製作標籤主機背景半透明
...代碼的Java
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
</TabHost>
代碼..
//create tabs
Resources res = getResources();
final TabHost MainTabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
MainTabHost.getTabWidget().setStripEnabled(false);
//call calendar Activity class
intent = new Intent().setClass(this, CalendarForm.class);
//intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
spec = MainTabHost.newTabSpec(res.getString(R.string.text_tabHost1)).setIndicator("Calendar",
res.getDrawable(R.drawable.calendar_ic)).setContent(intent);
MainTabHost.addTab(spec);
//call History Activity class
intent = new Intent().setClass(this, HistoryForm.class);
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
spec = MainTabHost.newTabSpec(res.getString(R.string.text_tabHost2)).setIndicator("History",
res.getDrawable(R.drawable.calendar_ic)).setContent(intent);
MainTabHost.addTab(spec);
//call Statistic Activity class
intent = new Intent().setClass(this, StatisticForm.class);
//intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
spec = MainTabHost.newTabSpec(res.getString(R.string.text_tabHost3)).setIndicator("Statistic",
res.getDrawable(R.drawable.calendar_ic)).setContent(intent);
MainTabHost.addTab(spec);
//setbackground Style of tabHost
MainTabHost.setCurrentTab(0);
MainTabHost.getTabWidget().setWeightSum(3);
final TabWidget tabHost=getTabWidget();
MainTabHost.setBackgroundResource(R.drawable.back_image);
//set background translucent..
MainTabHost.getTabWidget().getChildAt(0)setBackground(#50000000);
MainTabHost.getTabWidget().getChildAt(1).setBackground(#50000000)
MainTabHost.getTabWidget().getChildAt(2).setBackground(#50000000)
您是否製作了自己的drawables?它們的尺寸不一樣嗎? – Jack
你們他們是相同的大小 – AndroidDev