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界面框架。的更多相关文章

  1. WPF简单模拟QQ登录背景动画

    介绍 之所以说是简单模拟,是因为我不知道QQ登录背景动画是怎么实现的.这里是通过一些办法把它简化了,做成了类似的效果 效果图 大体思路 首先把背景看成是一个4行8列的点的阵距,X轴Y轴都是距离70.把 ...

  2. WPF简单模拟QQ登录背景动画(转)

    介绍 之所以说是简单模拟,是因为我不知道QQ登录背景动画是怎么实现的.这里是通过一些办法把它简化了,做成了类似的效果 效果图 大体思路 首先把背景看成是一个4行8列的点的阵距,X轴Y轴都是距离70.把 ...

  3. iOS开发之旅:实现一个APP界面框架

    在上一篇博客中,给大家介绍了一下我们传统的 APP 界面框架-标签导航的一些优缺点,在这篇文章中我会来给大家演示,如何用代码去实现这一框架.本次的实现我会分成俩部分来讲,好了闲话少说,接下来进入到开发 ...

  4. iOS开发——UI进阶篇(十三)UITabBarController简单使用,qq主流框架

    一.UITabBarController简单使用 // 程序加载完毕 - (BOOL)application:(UIApplication *)application didFinishLaunchi ...

  5. 模拟QQ侧滑控件 实现三种界面切换效果(知识点:回调机制,解析网络json数据,fragment用法等)。

    需要用到的lib包 :解析json  gson包,从网络地址解析json数据成String字符串的异步网络解析工具AsyncHttpClient等 下载地址:点击下载 Xlistview 下拉上拉第三 ...

  6. swift:用UITabBarController、UINavigationController、模态窗口简单的搭建一个QQ界面

    搭建一个QQ界面其实是一个很简单的实现,需要几种切换视图的控制器组合一起使用,即导航控制器.标签栏控制器.模态窗口.其中,将标签栏控制器设置为window的rootViewController,因为Q ...

  7. WPF案例 (三) 模拟QQ“快速换装"界面

    原文:WPF案例 (三) 模拟QQ"快速换装"界面 这个小程序使用Wpf模拟QQ快速换装页面的动画特效,通过使用组合快捷键Ctrl+Left或Ctrl+Right,可实现Image ...

  8. 分享一个漂亮WPF界面框架创作过程及其源码(转)

    本文会作为一个系列,分为以下部分来介绍: (1)见识一下这个界面框架: (2)界面框架如何进行开发: (3)辅助开发支持:Demo.模板.VsPackage制作. 框架源码如下所示. 本文介绍第(1) ...

  9. 利用phantomjs模拟QQ自动登录

    之前为了抓取兴趣部落里的数据,研究了下QQ自动登录. 当时搜索了一番,发现大部分方法都已经失效了,于是准备自己开搞. 第一个想到的就是参考网上已有方案的做法,梳理登陆js的实现,通过其他语言重写.考虑 ...

随机推荐

  1. iOS - Swift Dictionary 字典

    前言 public struct Dictionary<Key : Hashable, Value> : CollectionType, DictionaryLiteralConverti ...

  2. urllib.error.HTTPError: HTTP Error 403: Forbidden

    问题:  urllib.request.urlopen() 方法经常会被用来打开一个网页的源代码,然后会去分析这个页面源代码,但是对于有的网站使用这种方法时会抛出"HTTP Error 40 ...

  3. 多线程调用HttpWebRequest并发连接限制

    .net 的 HttpWebRequest 或者 WebClient 在多线程情况下存在并发连接限制,这个限制在桌面操作系统如 windows xp , windows  7 下默认是2,在服务器操作 ...

  4. yum的使用及配置

    yum的使用及配置 文章来源:http://www.ilanni.com/?p=9032 最近由于服务器需求,需要在公司内网搭建内网yum源. 搭建内网yum源需要分以下几个步骤,如下: 1. yum ...

  5. 关于vp8,vp8与264比较总结

    1 Other Codecs l MSN 使用的video codec “x-rtvc1”,09之前的版本使用的ML20.参考网址: http://www.amsn-project.net/forum ...

  6. 使用升级助 升级了win10,黑屏,无桌面 解决方案

    使用U盘重装即可. 事实证明,win10升级助手实在不咋地 优待又2: (1)保留原win7系统,有后悔药: (2)原系统的软件可用: 缺点: (1)装得慢,一上午: (2)开机慢,三分半 (3)开机 ...

  7. phalcon: tasks MainTask.php命令行工具

    phalcon: tasks MainTask.php命令行工具 tasks MainTask.php 一般用来做计划任务,处理比较复杂的大型的数据.然后其他功能或程序才能更简单的读取这些复杂的数据. ...

  8. De novo 测序基础知识

    名词解释 De novo:拉丁文,从头开始的意思,de nove测序则是指在不需要任何参考序列的情况下对某一物种进行基因组测序,然后将测得的序列进行拼接.组装,从而绘制该物种的全基因组序列图谱. 重测 ...

  9. refreshLayout 和 滑动控件的冲突解决

    listView.setOnScrollListener(new OnScrollListener() {           @Override     public void onScrollSt ...

  10. 使用node js 操作 Mysql 数据库

    使用node js 操作 Mysql 数据库 http://www.nodejs.org/ //node js 数据库操作 MySQL //使用https://github.com/felixge/n ...