<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabHost"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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"
>
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/localLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
<LinearLayout
android:id="@+id/sceneryLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost> tabhost.addTab(tabhost.newTabSpec("0").setIndicator("地区").setContent(R.id.channelLayout)
);
tabhost.addTab(tabhost.newTabSpec("1").setContent(R.id.programeLayout)
.setIndicator("风景")); tabhost.setCurrentTab(0);
tabhost.setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId) {
if (tabId.equals("0")) {
Intent intent = new Intent(CollectActivity.this,
CollectLActivity.class);
startActivity(intent); }
if (tabId.equals("1")) {
Intent intent = new Intent(CollectActivity.this,
CollectSActivity.class);
startActivity(intent);
}
}
});
刚开始显示的是地区,点地区选项时,显示地区,点风景选项的显示风景,刚开始没点怎么显示地区啊
android:id="@+id/tabHost"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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"
>
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/localLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
<LinearLayout
android:id="@+id/sceneryLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost> tabhost.addTab(tabhost.newTabSpec("0").setIndicator("地区").setContent(R.id.channelLayout)
);
tabhost.addTab(tabhost.newTabSpec("1").setContent(R.id.programeLayout)
.setIndicator("风景")); tabhost.setCurrentTab(0);
tabhost.setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId) {
if (tabId.equals("0")) {
Intent intent = new Intent(CollectActivity.this,
CollectLActivity.class);
startActivity(intent); }
if (tabId.equals("1")) {
Intent intent = new Intent(CollectActivity.this,
CollectSActivity.class);
startActivity(intent);
}
}
});
刚开始显示的是地区,点地区选项时,显示地区,点风景选项的显示风景,刚开始没点怎么显示地区啊
解决方案 »
- catch时exception信息指针为空
- Android在线更新是如何实现的?
- ImageView能不能不按原来的比例截图,或者把原来的图片调成新的比例
- android源码导入eclipse,framework层如果是通过实现aidl接口的函数无法实现单步调试
- 在搞一个android反编译的东东,遇到个问题,求教
- 求推荐几本android进阶用的好书
- android真机测试的问题。在网上搜了好久还是没解决!!
- ffmpeg里如何计算文件大小?
- webview直接输入html字符串 radio想实现监听
- Android环境搭建问题
- 怎么获得Canvas中的一个像素点的颜色值
- android Gallery getIntent().getData
而不是在tab这个activity中显示地区 风景
肯定不能显示啊!!
而不是在tab这个activity中显示地区 风景
http://blog.csdn.net/ch_984326013/article/details/6602602