我有这个PopUpWindow的布局:
<?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:orientation="vertical"
android:background="@color/colorbg">
</LinearLayout>
我试过添加android:margin = "10dp"
,但它不起作用,它仍然在右上角,没有任何边距。
谢谢。
我自己没有使用PopUpWindow
,但Android文档显示了一种方法:
showAtLocation(View parent, int gravity, int x, int y)
试试这个android:padding="10dip"
<?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:orientation="vertical"
android:padding="10dip"
android:background="@color/colorbg">
</LinearLayout>
或
尝试自定义弹出窗口点击此处