仿QQ的底部选项
效果图:

item_add.xml
<?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:background="#D1D1D1"
android:orientation="vertical" >
<Button
android:id="@+id/album"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="从相册中选取图片"
android:gravity="center"
android:textColor="#595959"
android:textSize="15sp"
android:background="@drawable/kuang_grey_white"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
/>
<Button
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="拍照选取图片"
android:gravity="center"
android:textSize="15sp"
android:textColor="#595959"
android:background="@drawable/kuang_grey_white"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
/>
<Button
android:id="@+id/cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="取消"
android:textSize="15sp"
android:gravity="center"
android:textColor="#595959"
android:background="@drawable/kuang_grey_white"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
/>
<View
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="#D1D1D1"
/>
</LinearLayout>
kuang_grey_white.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke android:width="1px" android:color="@color/view" />
<solid android:color="@color/white" />填充色
<corners android:radius="8dp" /> </shape>
方法:
public void showpopupwindow() {
LayoutInflater inflater = LayoutInflater.from(PersonalInfoActivity.this);
View v = inflater.inflate(R.layout.item_add, null);
Button album = (Button) v.findViewById(R.id.album);
Button camera = (Button) v.findViewById(R.id.camera);
Button cancel = (Button) v.findViewById(R.id.cancel);
album.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// 相册选择图片
//setalbumImg();
}
});
camera.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// setcameraImg(type2);
}
});
cancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
pw.dismiss();
}
});
// 一般来说,我们在onCreate里面得到的控件的宽高全是0.采用下面的方法,可以得到真实的宽高
int w = View.MeasureSpec.makeMeasureSpec(0,
View.MeasureSpec.UNSPECIFIED);
int h = View.MeasureSpec.makeMeasureSpec(0,
View.MeasureSpec.UNSPECIFIED);
v.measure(w, h);
int v_h = v.getMeasuredHeight();
int v_w = v.getMeasuredWidth();
pw = new PopupWindow(v, LayoutParams.MATCH_PARENT, v_h);
pw.setFocusable(true);
}
使用:
private PopupWindow pw;
showpopupwindow();
pw.showAtLocation(findViewById(R.id.m), Gravity.BOTTOM, 0, 0);//m是整个当前的根布局id
仿QQ的底部选项的更多相关文章
- Android高仿qq及微信底部菜单的几种实现方式
最近项目没那么忙,想着开发app的话,有很多都是重复,既然是重复的,那就没有必要每次都去写,所以就想着写一个app通用的基本框架,这里说的框架不是什么MVC,MVP,MVVM这种,而是app开发的通用 ...
- Fragment,仿QQ空间
转载请注明出处:http://blog.csdn.net/yangyu20121224/article/details/9023451 在今天的这篇文章当中,我依然会以实战加理论结合 ...
- android-改进<<仿QQ>>框架源代码
该文章主要改动于CSDN某大神的一篇文章,本人认为这篇文章的面向对象非常透彻,以下分享例如以下可学习的几点: Android应用经典主界面框架之中的一个:仿QQ (使用Fragment, 附源代码) ...
- jQuery实现的3个基础案例(仿QQ列表分组,二级联动下拉框,模拟员工信息管理系统)
1.仿QQ列表分组 <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type&quo ...
- android开发学习 ------- 仿QQ侧滑效果的实现
需要做一个仿QQ侧滑删除的一个效果: 一开始是毫无头绪,百度找思路,找到 https://blog.csdn.net/xiaxiazaizai01/article/details/53036994 ...
- 循序渐进实现仿QQ界面(一):园角矩形与双缓冲贴图窗口
印象里仿QQ界面的程序应该有很多,搜了一下,虽然出来一大堆,排除了重复的,却只有两三个,没我想象的好.经常看到CSDN上有人问,QQ这个功能怎么实现,那个界面怎么实现,归纳了一下,决定写这么一个仿QQ ...
- 循序渐进实现仿QQ界面(三):界面调色与控件自绘
本篇讲述如何进行界面调色.界面调色一般有两种方法,调色板和HSL色彩变换.调色板局限于256色,这里不采用,因此用HSL色彩变换实现.首先要了解一下什么是HSL色彩空间,完整且详尽的知识请到维基百科去 ...
- iOS天气动画、高仿QQ菜单、放京东APP、高仿微信、推送消息等源码
iOS精选源码 TYCyclePagerView iOS上的一个无限循环轮播图组件 iOS高仿微信完整项目源码 想要更简单的推送消息,看本文就对了 ScrollView嵌套ScrolloView解决方 ...
- SignalR快速入门 ~ 仿QQ即时聊天,消息推送,单聊,群聊,多群公聊(基础=》提升)
SignalR快速入门 ~ 仿QQ即时聊天,消息推送,单聊,群聊,多群公聊(基础=>提升,5个Demo贯彻全篇,感兴趣的玩才是真的学) 官方demo:http://www.asp.net/si ...
随机推荐
- C#封装好的Win32API
Kernel.cs using System; using System.Runtime.InteropServices; using System.Text; using HANDLE = Syst ...
- 图标:适配不同分辨 的 hdpi、mdpi、ldpi 文件夹
一:不同的layout Android手机屏幕大小不一,有480×320, 640×360, 800×480.怎样才能让App自动适应不同的屏幕呢? 其实很简单,只需要在res目录下创建不同的layo ...
- win7(64位)php5.5-Apache2.4-mysql5.6环境安装
原文链接http://jingyan.baidu.com/article/9faa723152c5d6473d28cb47.html 工具/原料 php-5.5.10-Win32-VC11-x64.z ...
- 方便的一站式svn/git服务器软件(linux)
https://www.scm-manager.org/ The easiest way to share and manage your Git, Mercurial and Subversion ...
- U盘centos7系统安装http://www.augsky.com/599.html
修改第二步中按TAB键出来的命令 这里注意了:网上很多文章都说这一步改成">vmlinuz initrd=initrd.img inst.stage2=hd:/dev/sdbquiet ...
- This kind of launch is configured to open the Debug perspective when it suspends.
This kind of launch is configured to open the Debug perspective when it suspends. 因为设置了断点才会弹出这个,不需要调 ...
- Spark Streaming中动态Batch Size实现初探
本期内容 : BatchDuration与 Process Time 动态Batch Size Spark Streaming中有很多算子,是否每一个算子都是预期中的类似线性规律的时间消耗呢? 例如: ...
- java文件名更改一直是false,看看是否是文件打开没有关
// 更改文件名称 public static void chenckFileName(String oldFile, String newFileName) { File file = new Fi ...
- 对于有了ACM以后的生活
我是大二学生,才接触ACM不到5个星期,因为受到我们班dalao的"引诱",去参加了一次我们学校举行的萌新杯,于是就入坑了,而我又在校外学习一些关于安全的知识,前几天一直纠结要不要 ...
- CSS 定位机制 position
position属性W3School有详细介绍 1.(position:relative;)相对定位会按照元素的原始位置对该元素进行移动.relative 2.(position:absolute;) ...