|
[/code]TabSpec ts1 = tabHost.newTabSpec(TAB_FUJIN).setIndicator(TAB_FUJIN);
ts1.setContent(new Intent(mainActivity.this, ListView_fujinActivity.class));
tabHost.addTab(ts1);
TabSpec ts2 = tabHost.newTabSpec(TAB_MSG).setIndicator(TAB_MSG);
ts1.setContent(new Intent(mainActivity.this, ListView_messageActivity.class));
tabHost.addTab(ts2);
TabSpec ts3 = tabHost.newTabSpec(TAB_TONGXUNLU).setIndicator(TAB_TONGXUNLU);
ts1.setContent(new Intent(mainActivity.this, ListView_tongxunluActivity.class));
tabHost.addTab(ts3);
TabSpec ts4 = tabHost.newTabSpec(TAB_MORE).setIndicator(TAB_MORE);
ts1.setContent(new Intent(mainActivity.this, ListView_moreActivity.class));
tabHost.addTab(ts4);
rGroup=(RadioGroup)findViewById(R.id.main_radio);
rGroup.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@Override
public void onCheckedChanged(RadioGroup group, int checkedId)
{
// TODO Auto-generated method stub
switch (checkedId)
{
case R.id.radio_button0:
tabHost.setCurrentTabByTag(TAB_FUJIN);
break;
case R.id.radio_button1:
tabHost.setCurrentTabByTag(TAB_MSG);
break;
case R.id.radio_button2:
tabHost.setCurrentTabByTag(TAB_TONGXUNLU);
break;
case R.id.radio_button3:
tabHost.setCurrentTabByTag(TAB_MORE);
break;
}
}
});
}
[/code]<TabHost android:id="@android:id/tabhost" android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
androidrientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0.0dip"
android:layout_weight="1.0" />
<TabWidget
android:id="@android:id/tabs"
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.0" />
<RadioGroup
android:gravity="center_vertical"
android:layout_gravity="bottom"
android:orientation="horizontal"
android:id="@+id/main_radio"
android:background="@drawable/maintab_toolbar_bg"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/radio_button0"
android:tag="radio_button0"
android:layout_marginTop="2.0dip"
android:text="@string/main_home"
android:drawableTop="@drawable/tab_fujin"
style="@style/main_tab_bottom" />
<RadioButton
android:id="@+id/radio_button1"
android:tag="radio_button1"
android:layout_marginTop="2.0dip"
android:text="@string/main_news"
android:drawableTop="@drawable/tab_mynews"
style="@style/main_tab_bottom" />
<RadioButton
android:id="@+id/radio_button2"
android:tag="radio_button2"
android:layout_marginTop="2.0dip"
android:text="@string/main_my_phone"
android:drawableTop="@drawable/tab_tongxunlu"
style="@style/main_tab_bottom" />
<RadioButton
android:id="@+id/radio_button3"
android:tag="radio_button3"
android:layout_marginTop="2.0dip"
android:text="@string/menu_more"
android:drawableTop="@drawable/tab_more"
style="@style/main_tab_bottom" />
</RadioGroup>
</LinearLayout>
</TabHost>
[/code]错在那? |
|