• [模拟Android微信]主界面


    首先看很像模仿:


    走出来:



    实现过程:

    依赖类库:actionbarsherlock

    用actionbarsherlock来实现顶部的搜索的效果。

    tab用的是Viewpaper实现的。


    详细细节:

    1.聊天、发现和通讯录地下的绿色的矩形和地下的灰色细线是重合的,怎么实现这样的效果呢。仅仅要使用

    RelativeLayout。然后使得两个ImageView的

    android:layout_alignBottom属性都指向同一个View。


    2.“聊天”右边的红底白字1

    要实现这个效果,能够通过重绘控件得到。

    该项目的cmm.ui.view.tabTextview就是这样一个控件。在OnDraw里面

    drawCircle和drawText等。


    3.加入button后出现的下拉菜单

    这个效果用的PopupWindow做的。

    // 载入数据  
    groups = new ArrayList<String>();
    groups.add("发起群聊");  
    groups.add("加入朋友");  
    groups.add("视频聊天");  
    groups.add("扫一扫");  
    groups.add("拍照分享");  
    //载入左側相应图标
    mbitmaplist = new ArrayList<Bitmap>();
    mbitmaplist.add(((BitmapDrawable)getResources().getDrawable(R.drawable.ofm_group_chat_icon)).getBitmap());
    mbitmaplist.add(((BitmapDrawable)getResources().getDrawable(R.drawable.ofm_add_icon)).getBitmap());
    mbitmaplist.add(((BitmapDrawable)getResources().getDrawable(R.drawable.ofm_video_icon)).getBitmap());
    mbitmaplist.add(((BitmapDrawable)getResources().getDrawable(R.drawable.ofm_qrcode_icon)).getBitmap());
    mbitmaplist.add(((BitmapDrawable)getResources().getDrawable(R.drawable.actionbar_camera_icon)).getBitmap());
    GroupAdapter groupAdapter = new GroupAdapter(this, groups, mbitmaplist);  
    lv_group.setAdapter(groupAdapter);  
    // 创建一个PopuWidow对象  
    popupWindow = new PopupWindow(view, 400, LayoutParams.WRAP_CONTENT, true);

    Popupwindow出如今偏右側,能够这样做:

    int xPos = (int)((windowManager.getDefaultDisplay().getWidth() - popupWindow.getWidth()) * (0.9));
            Log.e("coder", "xPos:" + xPos);  
      
            popupWindow.showAsDropDown(parent, xPos, 0);


    其它没什么,做的非常简陋,不喜请勿喷。

    下载链接是:http://download.csdn.net/detail/u012463359/7411731

    版权声明:本文博主原创文章。博客,未经同意不得转载。

  • 相关阅读:
    测试开发面试集锦_数据库
    测试开发面试集锦_linux
    测试开发面试题集锦_java
    Java中equals 和==的区别
    定时清理文件shell脚本
    java文件上传,upload使用
    python 获取错误日志,并发送邮件
    c语言代码审计规范
    渗透测试之nmap
    渗透测试之GoogleHack
  • 原文地址:https://www.cnblogs.com/lcchuguo/p/4865194.html
Copyright © 2020-2023  润新知