}
//实现就可以
CustomPopupWindowView pop = new CustomPopupWindowView(NLPGActivity.this,new ItemClick());
//显示窗体
pop.showAtLocation(view,Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 0);
popup_window_view.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/popup_window_view_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:gravity="center_horizontal">
<GridView
android:id="@+id/share_gridview"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/corners_bg"
android:verticalSpacing="20dp"/>
<TextView
android:id="@+id/cancel"
android:layout_below="@+id/share_gridview"
android:layout_height="42dp"
android:layout_width="fill_parent"
android:background="@drawable/corners_bg"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="@string/cancel"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textSize="20sp"
android:textColor="@color/light_blue"
android:layout_marginBottom="16dp"/>
</RelativeLayout>
popup_window_view_item.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_margin="20dp">
<ImageView
android:id="@+id/share_iv"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true"/>
<TextView
android:id="@+id/share_txt"
android:layout_below="@+id/share_iv"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="4dp"
android:layout_centerHorizontal="true"
android:textSize="12sp"/>
</RelativeLayout>
fade_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="600"
android:fromYDelta="100%p" />
</set>
fade_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="600"
android:toYDelta="100%p" />
</set>
style.xml
<style name="mystyle" parent="android:Animation">
<item name="@android:windowEnterAnimation">@anim/fade_in</item>
<item name="@android:windowExitAnimation">@anim/fade_out</item>
</style>