View contentView = LayoutInflater.from(context).inflate(R.layout.ly_setfun_pop, null, false);
final PopupWindow window = new PopupWindow(contentView, 600,ViewGroup.LayoutParams.WRAP_CONTENT, true);
window.setBackgroundDrawable(getResources().getDrawable(R.drawable.layer_list_mainlist));
window.setOutsideTouchable(true);
window.setTouchable(true);
window.showAtLocation(arg1, Gravity.CENTER,0,0);
window.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
}
});
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#345292"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/lyLine1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/selector_bg"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingEnd="0dp"
android:paddingStart="5dp"
android:paddingTop="5dp" >
<ImageView
android:layout_width="50px"
android:layout_height="50px"
android:layout_gravity="center_vertical"
android:contentDescription="@string/about"
android:src="@drawable/icon1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:text="text2"
android:textColor="#FFFFFF" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="5dp"
android:background="#4465AA" />
<LinearLayout
android:id="@+id/lyLine2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/selector_bg"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingEnd="0dp"
android:paddingStart="5dp"
android:paddingTop="5dp" >
<ImageView
android:layout_width="50px"
android:layout_height="50px"
android:layout_gravity="center_vertical"
android:contentDescription="@string/about"
android:src="@drawable/icon2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:text="text2"
android:textColor="#FFFFFF" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/bg1" android:state_pressed="false"/>
<item android:drawable="@color/bg2" android:state_pressed="true"/>
</selector>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bgScan">#345292</color>
<color name="bgScanPush">#416AC1</color>
</resources>