Android Popup Window 居于控件上方突出显示
public class TestPopupWindowActivity extends PopupWindow {
Activity context; public TestPopupWindowActivity(Activity context, View v) {
super(context);
this.context = context;
RelativeLayout mContentView = new RelativeLayout(context);
RelativeLayout.LayoutParams lpBg = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mContentView.setLayoutParams(lpBg); ImageView ivBg = new ImageView(context);
ivBg.setImageResource(R.mipmap.icon_alipay); mContentView.addView(ivBg); mContentView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); this.setContentView(mContentView);
this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
this.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
this.setFocusable(true);
this.setBackgroundDrawable(new ColorDrawable(Color.GRAY));
this.setOutsideTouchable(true);
this.update();
int popupWidth = mContentView.getMeasuredWidth();
int popupHeight = mContentView.getMeasuredHeight();
int[] location = new int[2];
v.getLocationOnScreen(location);
showAtLocation(v, Gravity.NO_GRAVITY, location[0] + v.getWidth() / 2 - popupWidth / 2, location[1] - popupHeight);
} }
Android Popup Window 居于控件上方突出显示的更多相关文章
- Android——android必看 各个控件属性(网上看到的文字,觉得挺好的,珍藏了)
属性 值 说明 Android:orientation horizontal/vertical 设置布局水平还是垂直,默认是垂直 android:checked true/false 标记默认选中,如 ...
- android中的EditView控件
android中的EditView控件 EditText继承关系:View-->TextView-->EditText ,EditText是可编辑文本框 1.EditText默认情况下,光 ...
- android中的TextView控件
我以前是搞ssh开发的,现在在搞android开发,所以简单学习了一下,对于自己所了解的做一个记录,也算是一个笔记吧,如果有什么不对的,希望大家给予一定的指导. 一.TextView的基本使用 Te ...
- Android中通过WebView控件实现与JavaScript方法相互调用的地图应用
在Android中通过WebView控件,可以实现要加载的页面与Android方法相互调用,我们要实现WebView中的addJavascriptInterface方法,这样html才能调用andro ...
- Android UI 之TextView控件属性列表
在网上收集到了TextView 的属性,在开发过程中还是挺有用的. android:autoLink 设置是否当文本为URL链接/email/电话号码/map时,文本显示为可点击的链接.可选值(non ...
- Android常用酷炫控件(开源项目)github地址汇总
转载一个很牛逼的控件收集帖... 第一部分 个性化控件(View) 主要介绍那些不错个性化的 View,包括 ListView.ActionBar.Menu.ViewPager.Gallery.Gri ...
- android获取自己定义控件位置坐标,屏幕尺寸,标题栏,状态栏高度
android获取自己定义控件位置坐标,屏幕尺寸,标题栏,状态栏高度 1.获取自己定义控件height 在本Activity中获取当前Activity中控件的height: Button button ...
- Android 常用炫酷控件(开源项目)git地址汇总
第一部分 个性化控件(View) 主要介绍那些不错个性化的 View,包括 ListView.ActionBar.Menu.ViewPager.Gallery.GridView.ImageView.P ...
- Android常用布局和控件
一.Android常用布局属性 1. LinearLayout的特有属性 android:orientation:设置布局排列方式 android:layout_weight:设置所占布局的权重 ...
随机推荐
- jQuery使用scrollTop获取div标签的滚动条已滚动高度(jQuery版本1.6+时,用prop()方法代替attr()方法)
$("#content").append('<div>' + data.msg + '</div>'+.'<br>');$('#content' ...
- 怎么设置BarTender中二维码大小为25*25
有小伙伴近期问了小编一个问题,说客户需要25*25大小的QR Code二维码,用BarTender怎么做出来?想要指定条形码的大小,还得BarTender符号与版本选项来帮忙.本文小编就来给大家详细讲 ...
- 防止dedecms注入文件挂马的解决方法
1.目录权限我们不建议用户把栏目目录设置在根目录,原因是这样进行安全设置会十分的麻烦,在默认的情况下,安装完成后,目录设置如下:(1) data.templets.uploads.a或5.3的html ...
- thinkphp 在阿里云上的nginx.config配置
# For more information on configuration, see: # * Official English Documentation: http://nginx.org/e ...
- Centos7.3.1611安装mysql5.7.18 rpm教程 并设置datadir
一.卸载MariaDB CentOS7默认安装MariaDB而不是MySQL,而且yum服务器上也移除了mysql相关的软件包.因为MariaDB和MySQL可能会冲突,故先卸载MariaDB. 1. ...
- Lambda模式
Class TestPatterns '<<1.Self-Defining Functions-自定义函数>> Public Shared Sub SelfDefining() ...
- elastic search 概念
1. index 与 type index 相当于 mysql 的 database, type 相当于 table 2. mapping mapping 相当于 mysql table 的列属性声明 ...
- iOS开发之-- 字符串的操作,去掉某一个字符或者替换成其他字符
一个简单的操作,记录下: NSString *strUrl = [urlString stringByReplacingOccurrencesOfString:@" " withS ...
- ios开发之--字符串局部改变颜色
改变指定位置字符的颜色,代码如下: NSString *descStr = @"楼主"; NSString *nickStr = [NSString stringWithForma ...
- 01python初识—编辑器&版本&变量知识
python2.0和3.0版本变化很大,要跟随脚步,学新的,用新的.3.0 python开发工具pycharm 5.0 python的交互器 python的程序一般放到Linux环境下运行. pyth ...