Curiously, using layout_margin doesn't work. Nonetheless,
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="10dp" android:clipToPadding="false"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="-10dp" android:layout_marginStart="-10dp" android:layout_marginEnd="-10dp" android:layout_marginBottom="-10dp" /> </FrameLayout>
seems to work (IntelliJ android preview).
Remember: android:clipToPadding="false" in the parent layout.
source share