popup_example.xml:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:padding="10dip"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     >      <TextView         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_marginTop="10dip"         android:text="Test Pop-Up"     />  </LinearLayout> 

LayoutInflater inflater = (LayoutInflater)        this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);     PopupWindow pw = new PopupWindow(        inflater.inflate(R.layout.popup_example, null, false),         100,         100,         true);     // 下面的代码假定你的根容器 id为 'main' 也就是parent view     pw.showAtLocation(this.findViewById(R.id.main), Gravity.CENTER, 0, 0);  

更多相关文章

  1. 经典的IoC/DI容器--StructureMap
  2. C++_STL常用容器总结:对组pair中关联容器与顺序容器
  3. (C++)错误的map删除操作和STL中容器的迭代器的底层实现机制
  4. C++ vector容器函数使用范例
  5. 利用ELK搭建Docker容器化应用日志中心
  6. 【从0到1学习边缘容器系列-4】弱网环境利器之分布式节点状态判定
  7. Docker容器跨主机通信之:直接路由方式
  8. 利用TICK搭建Docker容器可视化监控中心
  9. SpringBoot应用部署于外置Tomcat容器

随机推荐

  1. Android(安卓)多媒体扫描过程(Android(安
  2. Android中获取短信的内容
  3. Android(安卓)微信SDK分享功能中的最全过
  4. Android的文本编解码工具类
  5. 【email】android邮件Email
  6. Android(三)Android(安卓)SDK无法更新解
  7. android > android 客户端 ,PHP 服务器端
  8. android之实现各个组件点击事件监听
  9. This android SDk requires Android(安卓
  10. Android获取打开各种文件Intent汇总