实现PopupWindow透明效果,先在drawable定义一个文件:

<?xml version="1.0" encoding="UTF-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle"><gradient android:startColor="#c0000000" android:endColor="#c0000000"android:angle="90" /><!-- <stroke android:dashWidth="2dp" android:dashGap="2dp"android:width="2dp" android:color="#FF00ff00" /> 描边 --><corners android:bottomRightRadius="5dp"android:bottomLeftRadius="5dp" android:topLeftRadius="5dp"android:topRightRadius="5dp" /><!--设置圆角--></shape>

代码中:

/** * 初始化弹出等待窗口 */private void initPopWindow() {if (mPopupWindows == null) {View view = context.getLayoutInflater().inflate(R.layout.dialog_pop, null);mPopupWindows = new PopupWindow(view, 120, 100);((TextView) view.findViewById(R.id.message)).setText(mLoadingMsg);// mPopupWindows.setBackgroundDrawable(new BitmapDrawable());}if (mPopupWindows.isShowing()) {mPopupWindows.dismiss();}}

最后:

mPopupWindows.showAtLocation(context.findViewById(currentId),Gravity.CENTER, 0, 0);
具体参数查看源码

更多相关文章

  1. android 实现button的背景改变
  2. Android系统中自带的图标&一些预定义样式&参考颜色值
  3. android 状态栏透明,源码修改教程
  4. Android(安卓)Q 下拉状态栏快捷开关解析
  5. Android编译过程详解(三)
  6. Android编译过程详解(三)
  7. Switch自定义
  8. Android(安卓)onMeasure自定义
  9. Android(安卓)Init Language(android init.rc语法)

随机推荐

  1. Android绘制文本基本概念之- top, bottom
  2. android 6.0获取mac 地址都是02:00:00:00
  3. Android(安卓)能让你少走弯路的干货整理
  4. 我工作就是为了赚钱!
  5. android中使用okhttp实现文件上传
  6. 使用Android(安卓)Studio导入源码
  7. Android下Activity结束(finish())之后没有
  8. 通过SVN导入两个项目(从java移植到andorid
  9. 谈谈Android线程的认识
  10. Android开发之adb && 破解开屏图案 && 代