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. mysql查看进程

    select * from information_schema.processlist 查询所有连接到数据库的进程信息.

  2. inline和inline-block的间隙问题

    我们在前端布局的时候,会偶尔发现,在具有inline/inline-block属性的元素间存在一小段间隙,网上有些文章说这个间隙是6px,但我觉得应该是一个空格的宽度. 这里以inline-block ...

  3. KNN识别手写数字

    一.问题描述 手写数字被存储在EXCEL表格中,行表示一个数字的标签和该数字的像素值,有多少行就有多少个样本. 一共42000个样本 二.KNN KNN最邻近规则,主要应用领域是对未知事物的识别,即判 ...

  4. IDEA kotlin 配置

    修改 idea 安装目录 bin 目录 下 idea.properties   文件修改idea.max.intellisense.filesize=50000 避免proto 生成的java文件不被 ...

  5. ssh 设置反向代理

    远程主机上/etc/ssh/sshd_config中,开启 GatewayPorts yes systemctl reload sshd 本地: ssh -CqTnN -R 0.0.0.0:9000: ...

  6. select语法图

  7. springboot CommandLineRunner

    @SpringBootApplicationpublic class Application implements CommandLineRunner { public static void mai ...

  8. Hibernate使用固定值关联表

    假设表A与表B需要进行一对一关联,表A的a1字段等于表B的a1字段,同时表B中的b2字段需要为某一固定值,可采取如下方式配置: public class A { private String a; @ ...

  9. go,函数作为参数类型

    package main import "fmt" type testInt func(int) bool // 声明了一个函数类型 func isOdd(integer int) ...

  10. VB 共享软件防破解设计技术初探(三)

    ×××××××××××××××××××××××××××××××××××××××××××××× 其他文章快速链接: VB 共享软件防破解设计技术初探(一)http://bbs.pediy.com/sho ...