打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
android 之PopupWindow的使用
配置文件:
<?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>
 
 
java代码:
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); 
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
PopupWindow的基本使用
手把手教会popupWindow从下往上弹出效果的实现
按照预期初始化布局--layout inflation as intended
Layout Inflation as Intended
LayoutInflater作用及使用
关于如何提高ListView的滚动速度的问题
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服