我的第一篇博客,咱们直奔主题。先上个效果图
在android中自定义PopupWindow:
1、首先定义好你想要显示的窗口的布局文件,再实例化一个View对象:窗口布局可灵活变化,dialog_layout.xml代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/dialog_bg"
android:orientation="vertical"
android:padding="5dp" >
<TextView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:text="@string/tip"
android:gravity="center"
android:textSize="21sp"
android:layout_weight="0.7"
android:textColor="#000000"/>
<View
android:id="@+id/horiz