简单模拟QQ界面框架。
package com.lixu.qqjiemian; import java.util.Timer;
import java.util.TimerTask;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
//欢迎界面
public class WelcomActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.welcom); // 计时器
TimerTask timetask = new TimerTask() { @Override
public void run() {
Intent intent=new Intent(WelcomActivity.this, MainActivity.class);
startActivity(intent); }
};
// 设置时间长短
Timer time = new Timer();
time.schedule(timetask, 3000); }
}
package com.lixu.qqjiemian; import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.TextView; public class MainActivity extends Activity implements android.view.View.OnClickListener {
private TextView xiaoxi;
private TextView lianxiren;
private TextView dongtai; private TextView title; private Fragment xiaoxiFragment;
private Fragment lianxirenFragment;
private Fragment dongtaiFragment; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main); title = (TextView) findViewById(R.id.title); xiaoxi = (TextView) findViewById(R.id.xiaoxi);
lianxiren = (TextView) findViewById(R.id.lianxiren);
dongtai = (TextView) findViewById(R.id.dongtai); xiaoxi.setOnClickListener(this);
lianxiren.setOnClickListener(this);
dongtai.setOnClickListener(this); xiaoxiFragment = new XiaoxiFragment();
lianxirenFragment = new LianxirenFragment();
dongtaiFragment = new DongtaiFragment();
// 初始化的界面设置
choose(1);
title.setText(xiaoxi.getText() + " ");
chooseFragment(xiaoxiFragment); } // 设置点击事件
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.xiaoxi:
choose(1); chooseFragment(xiaoxiFragment); title.setText(xiaoxi.getText() + " "); break;
case R.id.lianxiren: choose(2); chooseFragment(lianxirenFragment); title.setText(lianxiren.getText() + " "); break;
case R.id.dongtai: choose(3); chooseFragment(dongtaiFragment); title.setText(dongtai.getText() + " "); break; default:
break;
} } private void choose(int pos) {
switch (pos) {
case 1:
xiaoxi.setTextColor(Color.BLUE);
xiaoxi.setBackgroundColor(Color.GRAY); lianxiren.setTextColor(Color.GRAY);
lianxiren.setBackgroundColor(Color.WHITE); dongtai.setTextColor(Color.GRAY);
dongtai.setBackgroundColor(Color.WHITE); break;
case 2:
lianxiren.setTextColor(Color.BLUE);
lianxiren.setBackgroundColor(Color.GRAY); xiaoxi.setTextColor(Color.GRAY);
xiaoxi.setBackgroundColor(Color.WHITE); dongtai.setTextColor(Color.GRAY);
dongtai.setBackgroundColor(Color.WHITE);
break; case 3:
dongtai.setTextColor(Color.BLUE);
dongtai.setBackgroundColor(Color.GRAY); lianxiren.setTextColor(Color.GRAY);
lianxiren.setBackgroundColor(Color.WHITE); xiaoxi.setTextColor(Color.GRAY);
xiaoxi.setBackgroundColor(Color.WHITE);
break; default:
break;
}
} // 选择不同的Fragment 的方法
private void chooseFragment(Fragment fragment) { FragmentManager fm = this.getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.fragment, fragment);
// 提交
ft.commit(); } }
package com.lixu.qqjiemian; import android.app.Fragment;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView; public class XiaoxiFragment extends Fragment { @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(android.R.layout.simple_list_item_1, null); TextView tv = (TextView) view.findViewById(android.R.id.text1);
tv.setText("消息界面");
tv.setBackgroundColor(Color.RED); return view;
}
}
package com.lixu.qqjiemian; import android.app.Fragment;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView; public class LianxirenFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(android.R.layout.simple_list_item_1, null); TextView tv = (TextView) view.findViewById(android.R.id.text1);
tv.setText("联系人界面");
tv.setBackgroundColor(Color.GREEN); return view;
}
}
package com.lixu.qqjiemian; import android.app.Fragment;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView; public class DongtaiFragment extends Fragment{ @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(android.R.layout.simple_list_item_1, null); TextView tv = (TextView) view.findViewById(android.R.id.text1);
tv.setText("动态界面");
tv.setBackgroundColor(Color.YELLOW); return view;
} }
xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1"
android:textColor="#f44336"
android:textSize="30sp" /> <FrameLayout
android:id="@+id/fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10" /> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" > <TextView
android:id="@+id/xiaoxi"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="消息"
android:textSize="15sp" /> <TextView
android:id="@+id/lianxiren"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="联系人"
android:textSize="15sp" /> <TextView
android:id="@+id/dongtai"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="动态"
android:textSize="15sp" />
</LinearLayout> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <ImageView
android:id="@+id/welcom"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/welcome" /> </LinearLayout>
manifest:<activity
android:name=".WelcomActivity"
android:label="@string/app_name"
android:noHistory="true" >
android:noHistory="true"写这个点击回退按钮 不回再回到欢迎界面。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lixu.qqjiemian"
android:versionCode="1"
android:versionName="1.0" > <uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="19" /> <application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
</activity> <activity
android:name=".WelcomActivity"
android:label="@string/app_name"
android:noHistory="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </manifest>
运行效果图:
简单模拟QQ界面框架。的更多相关文章
- WPF简单模拟QQ登录背景动画
介绍 之所以说是简单模拟,是因为我不知道QQ登录背景动画是怎么实现的.这里是通过一些办法把它简化了,做成了类似的效果 效果图 大体思路 首先把背景看成是一个4行8列的点的阵距,X轴Y轴都是距离70.把 ...
- WPF简单模拟QQ登录背景动画(转)
介绍 之所以说是简单模拟,是因为我不知道QQ登录背景动画是怎么实现的.这里是通过一些办法把它简化了,做成了类似的效果 效果图 大体思路 首先把背景看成是一个4行8列的点的阵距,X轴Y轴都是距离70.把 ...
- iOS开发之旅:实现一个APP界面框架
在上一篇博客中,给大家介绍了一下我们传统的 APP 界面框架-标签导航的一些优缺点,在这篇文章中我会来给大家演示,如何用代码去实现这一框架.本次的实现我会分成俩部分来讲,好了闲话少说,接下来进入到开发 ...
- iOS开发——UI进阶篇(十三)UITabBarController简单使用,qq主流框架
一.UITabBarController简单使用 // 程序加载完毕 - (BOOL)application:(UIApplication *)application didFinishLaunchi ...
- 模拟QQ侧滑控件 实现三种界面切换效果(知识点:回调机制,解析网络json数据,fragment用法等)。
需要用到的lib包 :解析json gson包,从网络地址解析json数据成String字符串的异步网络解析工具AsyncHttpClient等 下载地址:点击下载 Xlistview 下拉上拉第三 ...
- swift:用UITabBarController、UINavigationController、模态窗口简单的搭建一个QQ界面
搭建一个QQ界面其实是一个很简单的实现,需要几种切换视图的控制器组合一起使用,即导航控制器.标签栏控制器.模态窗口.其中,将标签栏控制器设置为window的rootViewController,因为Q ...
- WPF案例 (三) 模拟QQ“快速换装"界面
原文:WPF案例 (三) 模拟QQ"快速换装"界面 这个小程序使用Wpf模拟QQ快速换装页面的动画特效,通过使用组合快捷键Ctrl+Left或Ctrl+Right,可实现Image ...
- 分享一个漂亮WPF界面框架创作过程及其源码(转)
本文会作为一个系列,分为以下部分来介绍: (1)见识一下这个界面框架: (2)界面框架如何进行开发: (3)辅助开发支持:Demo.模板.VsPackage制作. 框架源码如下所示. 本文介绍第(1) ...
- 利用phantomjs模拟QQ自动登录
之前为了抓取兴趣部落里的数据,研究了下QQ自动登录. 当时搜索了一番,发现大部分方法都已经失效了,于是准备自己开搞. 第一个想到的就是参考网上已有方案的做法,梳理登陆js的实现,通过其他语言重写.考虑 ...
随机推荐
- html一般标签、常用标签、表格
body的属性: bgcolor 页面背景色 text 文字颜色 topmargin 上边距 leftmargi ...
- Win7_关闭休眠文件hiberfil.sys
1. C盘根目录下 hiberfil.sys 占用好几G空间,直接删 删不掉,也不推荐直接删. 2. 2.1.命令窗口中输入 powercfg -h off,即可关闭休眠功能,同时 Hiberfil. ...
- HTML5时代的Web缓存机制
HTML5 之离线应用Manifest 我们知道,使用传统的技术,就算是对站点的资源都实施了比较好的缓存策略,但是在断网的情况下,是无法访问的,因为入口的HTML页面我们一般运维的考虑,不会对其进行缓 ...
- openerp安装记录及postgresql数据库问题解决
ubuntu-14.04下openerp安装记录1.安装PostgreSQL 数据库 a.安装 sudo apt-get install postgresql 安装后ubu ...
- js图片跑马灯效果
<style. type="text/css">body{margin:0px auto; padding:0px;}ul,li{margin:0px; padding ...
- ora-01033:oracle initialization or shutdown in progress 解决方法
今天研究Oracle遇到了这个问题ora-01033:oracle initialization or shutdown in progress,经过分析研究终于解决了,写下来纪念一下.我的库是ora ...
- active developer path ("") does not exist
pod update --verbose --no-repo-update 出现的错误. 解决:在终端中修改你的CommandLine Tools的位置: xcode-select -switch / ...
- spring data jpa 创建方法名进行简单查询
版权声明:本文为博主原创文章,未经博主允许不得转载. spring data jpa 可以通过在接口中按照规定语法创建一个方法进行查询,spring data jpa 基础接口中,如CrudRepos ...
- 【服务器防护】WEB防护 - WEBSHELL攻击探测【转载】
原文:http://www.2cto.com/Article/201511/451757.html 1. 什么是webshell? 基于b/s架构的软件部署在Internet上,那么安全性是必 ...
- hiho_1290_demo_day
题目大意 一个MxN的矩阵,矩阵中的有些方格中有障碍物,有些没有,有一个机器人从左上角出发,它只能有两种移动方式:一直向右移动,直到遇到障碍物:一直向下移动,直到遇到障碍物. 现在可以将矩阵中 ...