【风马一族_Android】通过菜单的点击,跳转到不同界面
---恢复内容开始---
布局的代码: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】通过菜单的点击,跳转到不同界面的更多相关文章
- 【风马一族_Android】无线连接|调试Android手机
原文来自:http://www.cnblogs.com/sows/p/6269396.html (博客园的)风马一族 侵犯版本,后果自负 2017-01-10 15:03:31 准备阶段 1. 软 ...
- 【风马一族_Android】造作app的效果图
一.墨刀 官网:https://modao.cc
- 【风马一族_Android】手机与电脑通过adb进行连接
1:打开电脑的命令行 cmd 2:adb devices 查看与电脑连接的手机或模拟器的名称 3:准备要安装的apk.记住手机的名称 4:adb –s <模拟器名称> install & ...
- 【风马一族_Android】让app上传到Android市场的网站介绍
豌豆荚 开发者中心 http://open.wandoujia.com/account/info China app http://www.chinaapp.org
- 【风马一族_Android】Android Studio 给APP设置签名
在Android Studio中,给App签名,如果没有给App设置签名的话,Android Studio会主动给app设置一个默认的签名 接下来,介绍主动给App设置一个签名的整个步骤过程: 1) ...
- 【风马一族_Android】适合你 --- 大概的描述
适合你:专注于解决毕业生,离校所遗留的闲置教材的去向问题的一款APP. 目前的现状:毕业生的闲置教材,被清理宿舍的阿姨.大叔所清理到垃圾场,或拿到收破烂的地方,卖掉. 在毕业季中,存在的闲置物品不只有 ...
- 【风马一族_Android】强制activity的横屏与纵屏
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="ht ...
- 【风马一族_Android】多选按钮的监控事件
import android.app.Activity; import android.os.Bundle; import android.text.TextUtils; import android ...
- 【风马一族_Android】 图能
---------------------------------- 第一次 名称:相片查看器 ---------------------------------- 通过3D.自动播放幻灯片.旋转.跳 ...
随机推荐
- Jetty和Tomcat的使用及性能测试
一 测试目的 这次对Jetty和Tomcat进行性能测试,主要是为了给新版本WebPortal的开发选择合适的Java Web Server. 我们之前对老的Rest和新的TMMI都进行过性能测试,R ...
- CentOS修改163源(转载)
From:http://www.linuxidc.com/Linux/2012-08/69043.htm #CentOS-Base.repo其他版本文件在http://mirrors.163.com/ ...
- [Flex] ButtonBar系列——flex3 ButtonBar样式之颜色的填充
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="h ...
- nyoj 102 次方求摸 快速幂
点击打开链接 次方求模 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 求a的b次方对c取余的值 输入 第一行输入一个整数n表示测试数据的组数(n<100) 每组测 ...
- Js获取当前日期时间及时间相关操作
Js获取当前日期时间及时间格式 var myDate = new Date();myDate.getYear(); //获取当前年份(2位)myDate.getFullYear(); ...
- UIApplication及UIWindow
*:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...
- Skill
Skill Yasser is an Egyptian coach; he will be organizing a training camp in Jordan. At the end of ca ...
- 安装 chardet ,出现ImportError: No module named setuptools
原因:在linux的机子上没有setuptools 可能此机子上的python版本过低 http://www.cnblogs.com/kkgreen/archive/2012/08/02/262042 ...
- 剑指Offer:面试题8——旋转数组的最小值(java实现)
题目描述: 把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转. 输入 一个递增排序的数组的一个旋转 输出 旋转数组的最小元素. 例如数组{3,4,5,1,2}为{1,2,3,4,5}的 ...
- [AFUI]App Framework Plugins
---------------------------------------------------------------------------------------------------- ...