---恢复内容开始---

布局的代码:activity_main.xml

 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sowsceo.sms.MainActivity"> <TabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"> <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"> <TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"></TabWidget> <FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"></FrameLayout>
</LinearLayout>
</TabHost>
</RelativeLayout>

逻辑代码 :MainActivity.java  

 import android.app.TabActivity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TabHost; public class MainActivity extends TabActivity { private TabHost mTabHos; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); initTabHost();
} /**
* 初始化tabHost
*/
private void initTabHost() {
mTabHos = (TabHost) findViewById(android.R.id.tabhost); addTabSpec("conversation","会话",R.drawable.tab_conversation,new Intent(this,ConversationUI.class));
addTabSpec("folder","文件夹",R.drawable.tab_folder,new Intent(this,FolderUI.class));
addTabSpec("group","群组",R.drawable.tab_group,new Intent(this,GroupUI.class)); } /**
* 添加一个页签
* @param tag 标记
* @param label 标题
* @param icon 图标
* @param intent 指向的activity
*/
private void addTabSpec(String tag,String label,int icon,Intent intent){
TabHost.TabSpec newTabSpec = mTabHos.newTabSpec(tag); newTabSpec.setIndicator(label,getResources().getDrawable(icon));
//设置页签的标题与图标 newTabSpec.setContent(intent);
//设置页签指向的显示内容问activity mTabHos.addTab(newTabSpec);
//添加页签
} }

------------------------------

三个菜单的布局与代码

------------------------------

会话布局:activity_conversation_ui.xml

 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.sowsceo.sms.ConversationUI"> <TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="会话"
android:textSize="50sp"/>
</RelativeLayout>

逻辑代码:ConversationUI.java

 import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; /**
* 会话
*/
public class ConversationUI extends Activity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_conversation_ui);
}
}

-------------------------------------------

布局代码:activity_folder_ui.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sowsceo.sms.FolderUI"> <TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="文件夹"
android:textSize="50sp" />
</RelativeLayout>

逻辑代码:FolderUI.java

 import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; /**
*
* 创建者:风马一族
* 时间: 2016/8/9 19:06
* 说明:文件夹
*/ public class FolderUI extends Activity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_folder_ui);
}
}

----------------------------------

布局代码:activity_group_ui.xml

 
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.sowsceo.sms.FolderUI"> <TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="文件夹"
android:textSize="50sp" />
</RelativeLayout>

---恢复内容结束---

【风马一族_Android】通过菜单的点击,跳转到不同界面的更多相关文章

  1. 【风马一族_Android】无线连接|调试Android手机

    原文来自:http://www.cnblogs.com/sows/p/6269396.html   (博客园的)风马一族 侵犯版本,后果自负 2017-01-10 15:03:31 准备阶段 1. 软 ...

  2. 【风马一族_Android】造作app的效果图

    一.墨刀 官网:https://modao.cc

  3. 【风马一族_Android】手机与电脑通过adb进行连接

    1:打开电脑的命令行 cmd 2:adb devices 查看与电脑连接的手机或模拟器的名称 3:准备要安装的apk.记住手机的名称 4:adb –s <模拟器名称> install  & ...

  4. 【风马一族_Android】让app上传到Android市场的网站介绍

    豌豆荚  开发者中心 http://open.wandoujia.com/account/info China app http://www.chinaapp.org

  5. 【风马一族_Android】Android Studio 给APP设置签名

    在Android Studio中,给App签名,如果没有给App设置签名的话,Android Studio会主动给app设置一个默认的签名 接下来,介绍主动给App设置一个签名的整个步骤过程: 1) ...

  6. 【风马一族_Android】适合你 --- 大概的描述

    适合你:专注于解决毕业生,离校所遗留的闲置教材的去向问题的一款APP. 目前的现状:毕业生的闲置教材,被清理宿舍的阿姨.大叔所清理到垃圾场,或拿到收破烂的地方,卖掉. 在毕业季中,存在的闲置物品不只有 ...

  7. 【风马一族_Android】强制activity的横屏与纵屏

    <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="ht ...

  8. 【风马一族_Android】多选按钮的监控事件

    import android.app.Activity; import android.os.Bundle; import android.text.TextUtils; import android ...

  9. 【风马一族_Android】 图能

    ---------------------------------- 第一次 名称:相片查看器 ---------------------------------- 通过3D.自动播放幻灯片.旋转.跳 ...

随机推荐

  1. 如何使用javadoc

    package com.frank.chapter1; // object.Documentation1.java // TIJ4 Chapter Object, Exercise 13 - 1 /* ...

  2. [Java] cmd命令行如何切换目录

    cmd.exe是微软Windows系统基于WINDOWS上的命令解释程序,类似于微软的DOS操作系统.cmd.exe是一个32位的命令行程序,运行在Windows NT/2000/XP/2003/vi ...

  3. 303. Range Sum Query - Immutable

    Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive ...

  4. chrome 修改标签页

    插件名称:New Tab Redirect 标签格式:"file:///home/user/index.html"

  5. Android——状态栏通知栏Notification

    1.AndroidManifest.xml注意要同时注册Notification02Activity <!-- 状态通知栏 Notification -->        <acti ...

  6. 下载和编译 Open XML SDK

    我们需要一些工具来开始 Open XML 的开发. 开发工具 推荐的开发工具是 Visual Studio 社区版. 开发工具:Visual Studio Community 2013 下载地址:ht ...

  7. 下拉列表autocomplete各种实现方式比较

    方法一:用form 表单的datalist属性,此时会以首字母补充排序.实现效果参考:http://www.w3schools.com/html/tryit.asp?filename=tryhtml_ ...

  8. iOS中常见的设计模式——单例模式\委托模式\观察者模式\MVC模式

    一.单例模式 1. 什么是单例模式? 在iOS应用的生命周期中,某个类只有一个实例. 2. 单例模式解决了什么问题? 想象一下,如果我们要读取文件配置信息,那么每次要读取,我们就要创建一个文件实例,然 ...

  9. Drupal8开发教程:模块开发——创建新页面

    之前我们已经通过<Drupal8开发教程:认识.info.yml文件>对模块的YAML文件有了了解,今天我们来看如何通过模块开发的方式添加一个新的页面. 在 Drupal 7 中,通过模块 ...

  10. 【翻译】24款界面精美的免费UI工具包

    国外网站分享的24款最新的免费UI工具包,喜欢可以收藏哦~ 1. Modern UI Kit Modern UI Kit是一个非常简单时尚的免费用户界面包,提供上百种UI设计元素,可以让设计师轻松利用 ...