配置文件:
<?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);
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。