Android PopUpWindow - How to set margin?

android, android-layout, popupwindow

Solution

I have myself not used `PopUpWindow` but the Android docs show a method:

`showAtLocation(View parent, int gravity, int x, int y)`

Problem

I have this layout for 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> ``` I've tried adding `android:margin = "10dp"` but it won't work, it is still on the upper right with no margin at all. Thanks.

Original source

Related problems