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