main.xml

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" ><TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:layout_height="match_parent" android:orientation="vertical"> <TabWidget android:layout_width="match_parent" android:id="@android:id/tabs" android:layout_height="wrap_content"></TabWidget> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@android:id/tabcontent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab1"> <ImageView android:id="@+id/imageView2" android:src="@drawable/intnet" android:layout_width="match_parent" android:layout_height="match_parent"></ImageView> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab2"> <ImageView android:id="@+id/imageView4" android:src="@drawable/reresh" android:layout_height="match_parent" android:layout_width="match_parent"></ImageView> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab3"> <ImageView android:id="@+id/imageView5" android:src="@drawable/search" android:layout_height="match_parent" android:layout_width="match_parent"></ImageView> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab4"> <ImageView android:id="@+id/imageView3" android:src="@drawable/picture" android:layout_height="match_parent" android:layout_width="match_parent"></ImageView> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab5"> <ImageView android:id="@+id/imageView1" android:src="@drawable/info" android:layout_height="match_parent" android:layout_width="match_parent"></ImageView> </LinearLayout> </FrameLayout> </LinearLayout></TabHost></LinearLayout>

Activity

package rw.Tab;import android.app.TabActivity;import android.os.Bundle;import android.widget.TabHost;public class Tabhost02Activity extends TabActivity {    /** Called when the activity is first created. */ private TabHost tabHost;    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.main);        tabHost=getTabHost();        tabHost.addTab(tabHost.newTabSpec("network").setIndicator("流量",getResources().getDrawable(R.drawable.intnet)).setContent(R.id.tab1));        tabHost.addTab(tabHost.newTabSpec("refesh").setIndicator("刷新",getResources().getDrawable(R.drawable.reresh)).setContent(R.id.tab2));        tabHost.addTab(tabHost.newTabSpec("search").setIndicator("搜索",getResources().getDrawable(R.drawable.search)).setContent(R.id.tab3));        tabHost.addTab(tabHost.newTabSpec("picture").setIndicator("图片",getResources().getDrawable(R.drawable.picture)).setContent(R.id.tab4));        tabHost.addTab(tabHost.newTabSpec("info").setIndicator("信息",getResources().getDrawable(R.drawable.info)).setContent(R.id.tab5));            }}

Android TabHost风格_第1张图片


更多相关文章

  1. Andorid 网络流量统计
  2. Android手机操作系统中实现图片浏览
  3. Android 利用Matrix实现图片随手指平移、旋转、缩放
  4. 巧用Android图片资源,打造更精致的APP
  5. Android 渗透测试学习手册 第四章 对 Android 设备进行流量分析
  6. Android 实现图片保存到本地并调用本地地址显示图片
  7. Android设置拍照或者上传本地图片
  8. android 工程,点击图片,在屏幕显示

随机推荐

  1. Android:UI设置-横竖屏转换、输入法键盘相
  2. android-listview控件
  3. Android(安卓)蓝牙 UUID分类汇总
  4. 关于使用Android(安卓)Application的注意
  5. ListView滚动条问题
  6. android 笔记 --- Android Shadow 阴影制
  7. Android零碎知识点
  8. android wifi开发
  9. android中的数据存取SQLite----对各个方
  10. Android AIDL demo