技术标签: 仿微信demo 微信顶部操作栏加号按钮实现 Android笔记
android 仿微信demo————注册功能实现(移动端)
android 仿微信demo————注册功能实现(服务端)
android 仿微信demo————登录功能实现(移动端)
android 仿微信demo————登录功能实现(服务端)
android 仿微信demo————微信消息界面实现(移动端)
android 仿微信demo————微信消息界面实现(服务端)
android 仿微信demo————微信通讯录界面功能实现(移动端,服务端)
android 仿微信demo————微信顶部操作栏界面实现
android 仿微信demo————微信顶部操作栏搜索按钮实现(查询通讯录好友功能)
android 仿微信demo————微信顶部操作栏加号按钮实现(弹出子菜单)
上一篇中实现微信顶部操作栏搜索按钮,这一篇完善加号按钮功能
我们之前说过加号按钮可以通过toolbar的overflow实现,但是效果不理想,那么要实现微信那种效果,要怎么做呢?
有没有发现当点击加号后的弹出子菜单像不像我们之前在登录界面做的对话框有点类似,没错,可以对话框实现,我们可以自定义一个对话框,当点击加号按钮时便弹出一个对话框
创建对话框activity
MainTopRightDialog.java
package com.zhang.test.wxchatdemo1;
import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.LinearLayout;
public class MainTopRightDialog extends Activity {
private LinearLayout layout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_top_right_dialog);
//设置对话框activity的宽度等于屏幕宽度,一定要设置,不然对话框会显示不全
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);//需要添加的语句
layout=(LinearLayout)findViewById(R.id.main_dialog_layout);
layout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
@Override
public boolean onTouchEvent(MotionEvent event){
finish();
return true;
}
}
创建对应的布局
main_top_right_dialog.xml
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="46dp">
<LinearLayout
android:id="@+id/main_dialog_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:background="@drawable/title_function_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:src="@drawable/chat_img" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="发起群聊"
android:textColor="#fff"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:src="@drawable/add_friend_img" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="添加朋友"
android:textColor="#fff"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:src="@drawable/scan_scan_img" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="扫一扫"
android:textColor="#fff"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:src="@drawable/pay_img" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="收付款"
android:textColor="#fff"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:src="@drawable/help_img" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="帮助与反馈"
android:textColor="#fff"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
在之前的文章说过activity是会覆盖已有的activity(界面),所有我们需要在AndroidMainfest.xml中给activity设置一个自定义对话框主题,转换为对话框
在AndroidMainfest.xml中把activity转换为对话框
在style.xml中声明自定义的对话框
<style name="MyDialogStyleTop" parent="android:Theme.Dialog" >
<item name="android:windowAnimationStyle">@style/AnimTop2</item>
<item name="android:windowFrame">@null</item><!--边框-->
<item name="android:windowIsFloating">true</item><!--是否浮现在activity之上-->
<item name="android:windowIsTranslucent">true</item><!--半透明-->
<item name="android:windowNoTitle">true</item><!--无标题-->
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@android:color/transparent</item><!--背景透明-->
<item name="android:backgroundDimEnabled">false</item><!--模糊-->
</style>
<style name="AnimTop2" parent="@android:style/Animation">
<item name="android:windowEnterAnimation">@anim/push_top_in2</item>
<item name="android:windowExitAnimation">@anim/push_top_out2</item>
</style>
上面自定义的对话框样式继承Theme.Dialog转换为对话框,并且还给对话框设置动画属性,下面会给出这两个文件
创建动作文件anim
在动作文件中创建两个渐变尺寸伸缩动画效果scale文件
push_top_in2.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- 上下滑入式 -->
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromXScale="1.0"
android:toXScale="1.0"
android:fromYScale="0"
android:toYScale="1.0"
android:pivotX="0"
android:pivotY="10%"
android:duration="200" />
push_top_out2.xml
<?xml version="1.0" encoding="utf-8"?>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromXScale="1.0"
android:toXScale="1.0"
android:fromYScale="1.0"
android:toYScale="0"
android:pivotX="0"
android:pivotY="10%"
android:duration="200" />
测试前要把之前点击加号按钮跳转的activity注释取消掉
文章浏览阅读3.9k次。网页特效-综合特效-VBScript使用window.open打开新窗口与之间-->
文章浏览阅读839次。 一.引言VC++的MFC类库实际上是Windows下C++编程的一套最为流行的类库。MFC的框架结构大大方便了程序员的编程工作,但是为了更加有效、灵活的使用MFC编程,了解MFC的体系结构往往可以使编程工作事半功倍。它合理的封装了WIN32 API函数,并设计了一套方便的消息映射机制。但这套机制本身比较庞大和复杂,对它的分析和了解无疑有助于我们写出更为合理的高效的程序。这里我们简单的_析构消息响应
文章浏览阅读68次。1.libqrencode下载:https://fukuchi.org/works/qrencode/参考:https://www.cnblogs.com/LiuYanYGZ/p/12718058.html
文章浏览阅读773次。1、CORS跨域过滤器关于CORS跨域的概念这里不多解释, 不明白的同学自行百度。这是异步跨域请求以及前后端分离项目开发经常会遇到的问题, 现在跟大家说说怎么进行在Spring Security框架中增加跨域过滤器的配置。2、自定义Spring Security配置类中添加CorsFilter2.1 定义跨域配置类, 注入CorsFilterBean对象到容器CorsConfig配置类package com.kkarma.config;import org.springframework.c_spring security cors
文章浏览阅读168次。电容C5、C6、C7用于硬件防抖,R20,R21,R22是下拉电阻,按键没按下的时候,对应的IO口下拉位低电平,当按键按下的时候,对应的IO口为高电平。一般交通灯的倒计时在100秒以内,所以只需要两位数码管,就可以显示0--99之间的数字,4个方向,每个方向一个2位数码管,采用共阳数码管。因为有东南西北4个方向,东西方向的两组灯的状态是一样的,南北方向两组灯的状态是一样的。4、按键功能:禁行、东西通行、南北通行、时间加、时间减、切换、确认。2、左侧按键从上到下分别是:设置时间、时间加、时间减、紧急模式。_交通灯c语言程序设计
文章浏览阅读1.4k次。先说明一下为什么要将数组转换成Image类。我处理的图像是FITS (Flexible Image Transport System)文件,是一种灰度图像文件,也就是单通道图像。FITS图像的特点是灰度值取值为0~65535,这类图像在python下读成数组首先是不能直接转换成位图,也就不能用OpenCV、Image等方法了。如果是普通的jpg图像,用自带的Image库就能实现很多功能。下方的这幅..._矩阵转换成图片
文章浏览阅读1.7k次。作者:jikecheng,miaoxie,HarmonyOS内核技术专家HarmonyOS整体框架分为四个层级,如图1所示。从上到下,依次为:第一层是应用层,主要涵盖系统应用、Launcher、设置,以及三方应用。第二层是框架层,提供基础UI框架、用户程序框架以及能力模块框架。第三层是系统服务层,让HarmonyOS具有分布式流转负载的能力。大家看到的高速多设备协同能力就是由该层级提供。而承载整个操作系统,同时发挥芯片算力的基石就沉淀在第四层——内核层。宏观来说,内核的主要工作包含芯片资源管_hyperhold
文章浏览阅读584次。资源描述:第一章1 .电子数字计算机和电子模拟计算机的区别在哪里解电子数字计算机中处理的信息是在时间上离散的数字量,运算的过程是不连续的;电子模拟计算机中处理的信息是连续变化的物理量,运算的过程是连续的。2 .冯· 诺依曼计算机的特点是什么 其中最主要的一点是什么解冯· 诺依曼计算机的特点如下① 计算机(指硬件)应由运算器、存储器、控制器、输入设备和输出设备五大基本部件组成;② 计算机内部采用二进..._数字计算机处理的是在时间上和数值上
文章浏览阅读427次,点赞3次,收藏3次。本文涵盖了阿里巴巴、腾讯、字节跳动、京东、华为等大厂的Java面试真题,不管你是要面试大厂还是普通的互联网公司,这些面试题对你肯定是有帮助的,毕竟大厂一定是行业的发展方向标杆,很多公司的面试官同样会研究大厂的面试题。与此同时,今年算法面试一定是会被问的,而算法不是光靠背面试题就有用的,它是需要数学逻辑思维的,因此,我会在文末为大家准备一份非常优质的算法学习手册,重点在于学习思维方法,话不多说,直接开始上精选的大厂面试真题!由于文章篇幅限制,不可能将所有面试题以文字形式把大厂面试题展示出来,本篇_凭借这份前端面试宝典,我成功拿到了字节跳动、腾讯、阿里巴巴等六家大厂offer
文章浏览阅读3k次。使用Windows系统时,有些软件和服务会开机自启,甚至一些霸道软件(例如GlobalProtect,一款V|P|N工具)会默认开机自启且无法更改,那么如何管理这些启动项呢,下面以Win10为例介绍解决方案。_自启动管理
文章浏览阅读6.3k次,点赞3次,收藏7次。输入一棵二叉树,求该树的深度。从根结点到叶结点依次经过的结点(含根、叶结点)形成树的一条路径,最长路径的长度为树的深度。如果只有一个结点,则树的深度为1。/*struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : ..._二叉树深度计算举例
文章浏览阅读605次。自己用来总结的pandas笔记,个人向,记得比较简单目录简介数据结构seriesdataframe (二维数组,每列值为series)时间序列数值计算和统计基础文本数据操作数据数据分组透视表和交叉表文件读取 简介 基于numpy构建,兼容各种数据库,可之间读取数据 数据结构 series 带标签的一维数组..._pandas mean 不计算空值