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. eclipse 断点找到同名的其它类

    转载自Eclipse断点进入另一个项目的同名Java文件中(http://tunps.com/p/11789.html) eclipse 断点找到同名的其它类 A和B是两个相同的项目,A一直本地,B是 ...

  2. DateUtil日期处理

    package com.zjx.util; import java.text.SimpleDateFormat; import java.util.Date; public class DateUti ...

  3. iBatis与Hibernate有什么不同?

    相同点:屏蔽jdbc api的底层访问细节,使用我们不用与jdbc api打交道,就可以访问数据. jdbc api编程流程固定,还将sql语句与java代码混杂在了一起,经常需要拼凑sql语句,细节 ...

  4. scala -- 传名参数

    object Test{ def main(args: Array[String]): Unit = { def test(code : => Unit){// 传名参数 不计算函数值,而是把函 ...

  5. 面向对象三大特性一一多态(polymorphism)

    package com.bjsxt.oop.polymorphism; public class Animal { public void voice(){ System.out.println(&q ...

  6. node.js实时编译,不需要重启

    npm -g install supervisor 全局安装这个,然后编译依一次文件就可以了,之后修改这个文件不用编译也可以了

  7. java script 模拟鼠标事件

    try { var selector1 = "._3-8y:first-child"; var evt = document.createEvent("MouseEven ...

  8. xpath的层级与逻辑定位

    xpath的层级与逻辑定位: 之前我们是通过class和id,name,如果我们所需要的元素没有class,id,name这样的元素,怎么定位呢 1.在不使用xpath情况下:元素没有属性值得时候怎么 ...

  9. Python3 len()方法

    Python3 len()方法  Python3 字符串 描述 Python len() 方法返回对象(字符.列表.元组等)长度或项目个数. 语法 len()方法语法: len( s ) 参数 s - ...

  10. clamp 函数

    返回范围内的一个数值.可以使用 clamp 函数将不断增加.减小或随机变化的数值限制在一系列的值中. float clamp(float minnumber, float maxnumber, flo ...