模仿易信的UI

<?xml version="1.0" encoding= "utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="44dip"
android:gravity="center_vertical"
android:padding="0.0px" > <ImageView
android:id="@+id/rlCommenTitleBG"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/comm_title_bg" /> <TextView
android:id="@+id/ivTitleName"
style="@style/A1_Font"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:ellipsize="end"
android:gravity="center"
android:paddingLeft="96.0dip"
android:paddingRight="96.0dip"
android:singleLine="true"
android:text="@string/app_name" /> <ImageButton
android:id="@+id/ivTitleBtnLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dip"
android:layout_centerVertical="true"
android:background="@drawable/showleft_selector"
android:gravity="center"
android:includeFontPadding="false" /> <ImageButton
android:id="@+id/ivTitleBtnRigh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/showright_selector"
android:gravity="center"
android:layout_marginRight="5dip"
android:includeFontPadding="false" /> </RelativeLayout>
1.SlidingMenu
2.Fragment
记得建完一个新项目后,请添加刚刚下载的Slidingmenu库。方法: 右键项目--》Properties--》Android--》点击Add,就可以添加库
< LinearLayout 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:background ="@color/white"
android:clickable ="true"
android:orientation ="vertical" > <include layout= "@layout/main_title" android:focusable ="true" />
<FrameLayout
android:id ="@+id/content_frame"
android:layout_width ="match_parent"
android:layout_height ="match_parent" /> </ LinearLayout>
public class MainActivity extends SlidingFragmentActivity implementsOnClickListener{
protected SlidingMenu mSlidingMenu ;
private ImageButton ivTitleBtnLeft ;
private Fragment mContent ;
@Override
public void onCreate(Bundle savedInstanceState) {
super .onCreate(savedInstanceState);
initSlidingMenu();
setContentView(R.layout. activity_main );
initView();
}
private void initView() {
ivTitleBtnLeft = (ImageButton)this .findViewById(R.id. ivTitleBtnLeft);
ivTitleBtnLeft .setOnClickListener( this);
}
//初始化左侧菜单
private void initSlidingMenu() {
mContent = new Fragment_yixin();
getSupportFragmentManager()
.beginTransaction()
.replace(R.id. content_frame , mContent )
.commit();
setBehindContentView(R.layout. main_left_layout );//设置左边的菜单布局
FragmentTransaction mFragementTransaction = getSupportFragmentManager()
.beginTransaction();
Fragment mFrag = new LeftSlidingMenuFragment();
mFragementTransaction.replace(R.id. main_left_fragment , mFrag);
mFragementTransaction.commit();
mSlidingMenu = getSlidingMenu();
mSlidingMenu .setMode(SlidingMenu. LEFT); // 设置是左滑还是右滑,还是左右都可以滑,我这里只做了左滑
mSlidingMenu .setBehindOffsetRes(R.dimen. slidingmenu_offset); // 设置菜单宽度
mSlidingMenu .setFadeDegree(0.35f);// 设置淡入淡出的比例
mSlidingMenu .setTouchModeAbove(SlidingMenu. TOUCHMODE_FULLSCREEN); //设置手势模式
mSlidingMenu .setShadowDrawable(R.drawable. shadow); // 设置左菜单阴影图片
mSlidingMenu .setFadeEnabled( true); // 设置滑动时菜单的是否淡入淡出
mSlidingMenu .setBehindScrollScale(0.333f);// 设置滑动时拖拽效果
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.ivTitleBtnLeft :
//点击标题左边按钮弹出左侧菜单
mSlidingMenu .showMenu( true);
break ;
default :
break ;
}
}
/**
* 左侧菜单点击切换首页的内容
*/
public void switchContent(Fragment fragment) {
mContent = fragment;
getSupportFragmentManager()
.beginTransaction()
.replace(R.id. content_frame , fragment)
.commit();
getSlidingMenu().showContent();
}
}
左侧菜单: LeftSlidingMenuFragment
public class LeftSlidingMenuFragment extends Fragment implements OnClickListener{
private View yixinBtnLayout; //左侧菜单的易信功能
private View circleBtnLayout; //左侧菜单的朋友圈功能
private View settingBtnLayout; //左侧菜单的设置功能
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.main_left_fragment, container,
false);
yixinBtnLayout = view.findViewById(R.id.yixinBtnLayout);
yixinBtnLayout.setOnClickListener(this);
circleBtnLayout = view.findViewById(R.id.circleBtnLayout);
circleBtnLayout.setOnClickListener(this);
settingBtnLayout = view.findViewById(R.id.settingBtnLayout);
settingBtnLayout.setOnClickListener(this);
System.out.println();
return view;
}
@Override
public void onClick(View v) {
Fragment newContent = null;
switch (v.getId()) {
case R.id.yixinBtnLayout: //易信的点击事件
newContent = new Fragment_yixin();
yixinBtnLayout.setSelected(true);
circleBtnLayout.setSelected(false);
settingBtnLayout.setSelected(false);
break;
case R.id.circleBtnLayout: //朋友圈的点击事件
newContent = new Fragment_friend();
yixinBtnLayout.setSelected(false);
circleBtnLayout.setSelected(true);
settingBtnLayout.setSelected(false);
break;
case R.id.settingBtnLayout: //设置的点击事件
newContent = new Fragment_setting();
yixinBtnLayout.setSelected(false);
circleBtnLayout.setSelected(false);
settingBtnLayout.setSelected(true);
break;
default:
break;
}
if (newContent != null)
switchFragment(newContent);
}
/*
* 切换到不同的功能内容
*/
private void switchFragment(Fragment fragment) {
if (getActivity() == null)
return;
MainActivity ra = (MainActivity) getActivity();
ra.switchContent(fragment);
}
}
<? xml version ="1.0" encoding= "utf-8" ?>
< FrameLayout xmlns:android ="http://schemas.android.com/apk/res/android"
android:id ="@+id/main_left_fragment"
android:layout_width ="match_parent"
android:layout_height ="match_parent"
android:background ="@color/white" > </ FrameLayout>
<? xml version ="1.0" encoding= "utf-8" ?>
< ScrollView android:background ="@color/tools_box_bg" android:scrollbars ="none" android:layout_width ="fill_parent" android:layout_height ="fill_parent"
xmlns:android ="http://schemas.android.com/apk/res/android" >
<LinearLayout android:orientation= "vertical" android:id ="@+id/llRoot"android:layout_width ="fill_parent" android:layout_height ="wrap_content" >
< com.chaowen.yixin.RoundedImageView android:layout_gravity ="center_horizontal" android:id ="@+id/headImageView" android:layout_width ="wrap_content" android:layout_height ="wrap_content" android:layout_marginTop = "25.0dip" android:src ="@drawable/head_default_yixin" android:adjustViewBounds = "true" android:maxHeight ="80dip" android:maxWidth= "80dip" />
< TextView android:textSize ="16.0sp" android:textColor ="#ffccccc6"android:layout_gravity ="center_horizontal" android:id ="@+id/nickNameTextView"android:layout_width ="wrap_content" android:layout_height ="wrap_content"android:layout_marginTop = "10.0dip" android:text ="511644784" />
< TextView android:textSize ="12.0sp" android:textColor ="#ffa8a8a3"android:layout_gravity ="center_horizontal" android:id ="@+id/yixinCodeTextView" android:layout_width ="wrap_content" android:layout_height ="wrap_content"android:layout_marginLeft = "10.0dip" android:layout_marginTop = "6.0dip"android:layout_marginRight = "10.0dip" android:layout_marginBottom = "10.0dip" />
< include android:id ="@+id/yixinBtnLayout" layout ="@layout/toolbox_item_yixin" />
< include android:id ="@+id/circleBtnLayout" layout ="@layout/toolbox_item_friend" />
< include android:id ="@+id/settingBtnLayout" layout ="@layout/toolbox_item_setting" />
< View android:background ="#ff1c1c1b" android:layout_width ="fill_parent" android:layout_height ="1.3299866dip" />
< View android:background ="#ff474745" android:layout_width ="fill_parent" android:layout_height ="1.0px" />
< TextView android:textSize ="12.0sp" android:textColor ="#ff999994"android:gravity ="center" android:layout_gravity ="bottom|center" android:id ="@+id/inviteFriendBtnLayout" android:background ="@drawable/tools_box_invite_btn_selector" android:layout_width= "wrap_content"android:layout_height ="wrap_content" android:layout_marginTop = "70.0dip"android:text ="邀请好友" />
</LinearLayout >
</ ScrollView>
http://pan.baidu.com/share/link?shareid=3913241068&uk=1863281063
模仿易信的UI的更多相关文章
- Android UI开发第四十二篇——实现实现易信的圆形图像和对话列表的图像显示部分
显示图像时,很多个性化显示,圆形或圆角.气泡等等,我们这一篇文章探讨一下圆形和气泡的显示,仿照易信中的实现,先看下效果图: 代码: public class RoundImageView extend ...
- CRM客户关系管理系统 北京易信软科信息技术有限公司
北京易信软科信息技术有限公司 推出大型erp系统,库存管理系统,客户关系管理系统,车辆登记管理系统,员工管理系统,采购管理系统,销售管理系统,为您的企业提供最优质的产品服务 北京易信软科您可信赖的北京 ...
- 北京易信软科信息技术有限公司 问卷调查管理系统V2.0
北京易信软科信息技术有限公司 问卷调查管理系统V2.0 支持题目模板配置.题型模板配置.选项模板配置,报表查询功能配置 按月建表功能 运用java开发.velocity技术实现页面加载功能,高性能,高 ...
- 北京易信软科信息技术有限公司-仓库管理系统V1.0
北京易信软科您可信赖的北京软件研发服务商,公司团队有多年应用软件设计制作及开发经验,为各大企业提供软件设计.制作及维护服务,为用户提供可靠高效的应用服务平台 我们通过专业的项目实施流程,为您提供优质的 ...
- 从iMessage到微信,QQ离线短信服务,米聊,易信
把iMessage.米聊.QQ离线短信服务.微信.易信放到一下,毫无疑问大家能够看出他们的共同点,iMessage与米聊我们就不用说了,有雷布斯的存在就有米聊的存在,QQ离线短信服务是提供给QQ会员的 ...
- JAVA调用易信接口向指定好友推送消息(二)POST测试
易信的API接口做的还算简单 http://open.yixin.im/document/oauth/api 根据指南上的步骤,利用易信提供的测试ID AppID(client_id): yxbbd0 ...
- JAVA调用易信接口向指定好友推送消息(一)背景需求
众所周知,中国电信内部一直使用易信群进行交流 各种工作交流都在易信群里面沟通 包括投诉处理,障碍报修,拍照上传 最重要的就是每天甚至每个时点的指标完成情况的通报 所以只能用4个字来形容 String ...
- 微信/易信公共平台开发(二):自定义菜单的PHP实现(提供源码)
微信把公众号分成订阅号和服务号两种,服务号可以自定义菜单, 菜单大大方便了用户操作. 比如:公众服务号 "中国南方航空" 的自定义菜单如下图: 点菜单就可以直接进入操作了,方便! ...
- “易信”今日正式更新至V1.1版
热门移动通讯社交应用“易信”今日正式更新至V1.1版,目前用户已可在苹果AppStore和各大Android商店下载.新版本主要包括三大变化:开通公众平台.提供外部分享.强化社交安全,此外包含好友关系 ...
随机推荐
- PHP动态函数
header('Content-type:text/html;Charset=utf8'); function welcome(){ echo 'Welcome to you.'; } functio ...
- Ubuntu 16.04 Vysor 破解 和黑屏问题解决+ 闪屏问题解决
最新破解更新说明: 参考本人blog: 点我呀 黑屏解决 Vysor使用和黑屏问题 经过了一段时间的艰辛探索,确定是我chrome的PNaCl没有安装,然后又是一段艰辛的Google之后,终于在一个链 ...
- 每天一道LeetCode--409 .Longest Palindrome
Given a string which consists of lowercase or uppercase letters, find the length of the longest pali ...
- C#反射(转载)
[转]C#反射 反射(Reflection)是.NET中的重要机制,通过放射,可以在运行时获得.NET中每一个类型(包括类.结构.委托.接口和枚举等)的成员,包括方法.属性.事件,以及构造函数等. ...
- 七、Android学习笔记_JNI hello world
1.需要准备的工具,eclipse,cdt(c++)插件,cygwin(unix)和 android ndk. 在cygwin的etc目录下将ndk的路径引入到profile文件中,可以在cygwin ...
- Linux 系统中用户切换(su user与 su - user 的区别)
1. Linux系统中用户切换的命令为su,语法为: su [-fmp] [-c command] [-s shell] [--help] [--version] [-] [USER [ARG]] 参 ...
- Javascript之数据执行原理探究
Javascript在Web服务器端执行原理: 1.客户端请求数据,即我们在上网时在地址栏中输入某个网址,浏览器接收到数据之后,向远程web服务器发送请求报文. 2.web服务器响应请求,web服务器 ...
- 实现百度外卖APP个人中心头像"浪"起来的动画效果
让你的头像浪起来~~~~~ DEMO 地址:网页链接,点击下载 你需要知道的 CADisplayLink 简单的说就是一定时器,其根本利用刷帧和屏幕频率一样来重绘渲染页面. 其创建方式: [Objec ...
- Linux驱动编程--基于I2C子系统的I2C驱动
代码中,我添加了很多注释,应该不难理解,有错误大家可以指出来,我再改正 #include <linux/kernel.h> #include <linux/module.h> ...
- APUE习题8.7
看书的时候发现这个习题没有答案,于是就想把自己做的结果贴上来,和大家分享分享! 首先把题目贴上来吧: /*********** 8.10节中提及POSIX.1要求在调用exec时关闭打开的目录流.按下 ...