1. //MainActivity.java
  2.  
  3. public class MainActivity extends TabActivity  
  4. {  
  5.     @Override  
  6.     public void onCreate(Bundle savedInstanceState)  
  7.     {  
  8.         super.onCreate(savedInstanceState);  
  9.         setContentView(R.layout.main);  
  10.         // 获取该Activity里面的TabHost组件  
  11.         TabHost tabHost = getTabHost();  
  12.         // 创建第一个Tab页  
  13.         TabHost.TabSpec tab1 = tabHost.newTabSpec("tab1")  
  14.                 .setIndicator("已接电话") // 设置标题  
  15.                 .setContent(R.id.tab01); //设置内容  
  16.         // 添加第一个标签页  
  17.         tabHost.addTab(tab1);  
  18.         TabHost.TabSpec tab2 = tabHost.newTabSpec("tab2")  
  19.                 // 在标签标题上放置图标  
  20.                 .setIndicator("呼出电话", getResources()  
  21.                         .getDrawable(R.drawable.tiger))  
  22.                 .setContent(R.id.tab02);  
  23.         // 添加第二个标签页  
  24.         tabHost.addTab(tab2);  
  25.         TabHost.TabSpec tab3 = tabHost.newTabSpec("tab3")  
  26.                 .setIndicator("未接电话")  
  27.                 .setContent(R.id.tab03);  
  28.         // 添加第三个标签页  
  29.         tabHost.addTab(tab3);  
  30.     }  
  31. }  
  32.     
  33.  
  34. //XML文件  
  35.  
  36. <?xml version="1.0" encoding="utf-8"?>  
  37. <TabHost  
  38.    xmlns:android="http://schemas.android.com/apk/res/android"  
  39.    android:id="@android:id/tabhost"  
  40.    android:layout_width="match_parent"  
  41.    android:layout_height="match_parent"  
  42.    android:layout_weight="1">  
  43.    <LinearLayout  
  44.       android:layout_width="match_parent"  
  45.       android:layout_height="match_parent"  
  46.       android:orientation="vertical">  
  47.       <TabWidget  
  48.          android:id="@android:id/tabs"  
  49.          android:layout_width="match_parent"  
  50.          android:layout_height="wrap_content"/>  
  51.       <FrameLayout  
  52.          android:id="@android:id/tabcontent"  
  53.          android:layout_width="match_parent"  
  54.          android:layout_height="match_parent">  
  55.          <!-- 定义第一个标签页的内容 -->  
  56.          <LinearLayout  
  57.             android:id="@+id/tab01"  
  58.             android:orientation="vertical"  
  59.             android:layout_width="match_parent"  
  60.             android:layout_height="match_parent">  
  61.             <TextView  
  62.                android:layout_width="wrap_content"  
  63.                android:layout_height="wrap_content"  
  64.                android:text="女儿国国王 - 2012/12/12"  
  65.                android:textSize="11pt" />  
  66.             <TextView  
  67.                android:layout_width="wrap_content"  
  68.                android:layout_height="wrap_content"  
  69.                android:text="东海龙女 - 2012/12/18"  
  70.                android:textSize="11pt" />  
  71.          </LinearLayout>  
  72.          <!-- 定义第二个标签页的内容 -->  
  73.          <LinearLayout  
  74.             android:id="@+id/tab02"  
  75.             android:orientation="vertical"  
  76.             android:layout_width="match_parent"  
  77.             android:layout_height="match_parent">  
  78.             <TextView  
  79.                android:layout_width="wrap_content"  
  80.                android:layout_height="wrap_content"  
  81.                android:text="白骨精  - 2012/08/12"  
  82.                android:textSize="11pt" />  
  83.             <TextView  
  84.                android:layout_width="wrap_content"  
  85.                android:layout_height="wrap_content"  
  86.                android:text="蜘蛛精 - 2012/09/20"  
  87.                android:textSize="11pt" />  
  88.          </LinearLayout>  
  89.          <!-- 定义第三个标签页的内容 -->  
  90.          <LinearLayout  
  91.             android:id="@+id/tab03"  
  92.             android:orientation="vertical"  
  93.             android:layout_width="match_parent"  
  94.             android:layout_height="match_parent"  
  95.             android:textSize="11pt">  
  96.             <TextView  
  97.                android:layout_width="wrap_content"  
  98.                android:layout_height="wrap_content"  
  99.                android:text="孙悟空 - 2012/09/19"  
  100.                android:textSize="11pt" />  
  101.             <TextView  
  102.                android:layout_width="wrap_content"  
  103.                android:layout_height="wrap_content"  
  104.                android:text="猪八戒  - 2012/10/12"  
  105.                android:textSize="11pt" />  
  106.          </LinearLayout>  
  107.       </FrameLayout>  
  108.    </LinearLayout>  
  109. </TabHost>  

效果:

TabHost实现通话记录界面的更多相关文章

  1. Android通讯录管理(获取联系人、通话记录、短信消息)

    前言:前阵子主要是记录了如何对联系人的一些操作,比如搜索,全选.反选和删除等在实际开发中可能需要实现的功能,本篇博客是小巫从一个别人开源的一个项目抽取出来的部分内容,把它给简化出来,可以让需要的朋友清 ...

  2. Android-读取操作系统通话记录并/拨打电话/发送短信/复制号码到拨号盘

    apps目录的contacts应用(有读取通话记录功能),是访问provider目录的provider.contacts应用(有暴露通话记录),所以要阅读Android操作系统源码-->pack ...

  3. CSipSimple通话记录分组

    为了便于查看通话记录,通常要对通话记录进行分组.本质上来说这没什么难度,只需要用ContentResolver去读数据库,剩下的就是策略问题.代码在com/csipsimple/ui/calllog/ ...

  4. hadoop处理Excel通话记录

    前面我们所写mr程序的输入都是文本文件,但真正工作中我们难免会碰到需要处理其它格式的情况,下面以处理excel数据为例 1.项目需求 有刘超与家庭成员之间的通话记录一份,存储在Excel文件中,如下面 ...

  5. 内容观察者 ContentObserver 监听短信、通话记录数据库 挂断来电

    Activity public class MainActivity extends ListActivity {     private TextView tv_info;     private  ...

  6. android 获取通话记录

    在manifest添加以下权限<uses-permission android:name="android.permission.READ_CALL_LOG" />&l ...

  7. 建立一个类似于天眼的Android应用程序:第4部分 - 持久收集联系人,通话记录和短信(SMS)

    建立一个类似于天眼的Android应用程序:第4部分 - 持久收集联系人,通话记录和短信(SMS) 电话黑客android恶意软件编程黑客入侵linux 随着我们继续我们的系列,AMUNET应用程序变 ...

  8. 越狱的 ios 如何 获取 读取 提取 手机上的 短信 通话记录 联系人 等信息

    http://willson.sinaapp.com/2011/12/iphone 获取短信脚本.html  Iphone获取短信脚本http://bbs.9ria.com/thread-209349 ...

  9. 【Android】Android6.0读取通话记录

    需求:读取通话记录,然后列表显示,每条记录的数据包括姓名.号码.类型(来电.去电.未接,字体颜色分别为绿.蓝.红),然后长按条目弹出一个列表弹窗,显示[复制号码到拨号盘].[发短信].[打电话]. 先 ...

随机推荐

  1. Maven 多环境 打包

    1.pom.xml文件添加profiles属性 <profiles> <profile> <id>dev</id> <activation> ...

  2. mysql启动报错 The server quit without updating PID file

    [root@uz6542 data]# /etc/init.d/mysqld startStarting MySQL... ERROR! The server quit without updatin ...

  3. InitComponent的使用

    网页中的数据,有些是不在网页上改变的,像一些个人信息,比如:头像,当前用户名,友情链接等等,每次请求该页面都要重新加载,这样很消耗服务器资源,会降低服务器的性能,这个时候我们可以把这些不变的信息,统一 ...

  4. java.lang.AbstractMethodError: com.microsoft.jdbc.base.BaseDatabaseMetaData.supportsGetGeneratedKeys()Z

    解决:问谷老师得知是microsoft提供的数据库驱动存在bug.需要换一种驱动连接,使用jtds(下载地址:http://sourceforge.net/projects/jtds/files/)下 ...

  5. 迷你MVVM框架 avalonjs 学习教程10、样式操作

    一般情况下我们通过设置类名就可以改变元素的样式,但涉及到动画部分,就一定需要设置内联样式了,因此有了ms-css.*ms-css*的用法为ms-css-样式名="样式值", 如ms ...

  6. Linux下启动Tomcat启动并显示控制台日志信息

    Linux下如何启动Tomcat像Windows启动并显示控制台日志信息一样? Windows下启动tomcat,一般直接运行startup.bat,启动后如下图所示: Linux下直接启动./sta ...

  7. JPA报错, PersistenceException_Unable to build Hibernate SessionFactory

    javax.persistence.PersistenceException: [PersistenceUnit: TestJPA] Unable to build Hibernate Session ...

  8. 表单跳转到Struts2

    在使用表单跳转到Struts2时,路径一直不正确. login.html如下: <form action="login.do" method=post> 账号:< ...

  9. iOS - 工程文件冲突 - 解决方式

  10. 25-javaweb接入支付宝支付接口

    想熟悉支付宝接口支付,后面可能会用,不如在课设中试试手.好吧听说支付宝不微信支付要简单些,就拿支付宝的先练下手吧. 基本学习流程,百度一下,找篇博客看下. 推荐下面这个篇博客,讲的挺好的,复制过来. ...