• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Remove widget margins in Relative layout?

RED_

Well-Known Member
Nov 13, 2010
209
8
London
Essentially as the title says.

I've built a widget; where I want one corner to be right up against the edge of the screen. It's a horizontal widget and made using a relative layout. It's the right hand side margin that I want right up against the screen edge. I've already tried the following:

Code:
android:layout_marginRight="-20dp"

This did move the entire widget closer to the edge but increasing the dp after that did nothing. It just stopped there, with a gap still there (albeit now a smaller gap).

I've tried using android:gravity. The background of this widget is a drawable shape with a button on it (coded via main.xml as normal). I've tried the above bits of code on both the drawable background XML and the main XML. Nothing works.

I'm sure there is an easy fix to this hence why I'm posting in Dev 101. Thanks in advance!
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones