1. Check out our companion app, Forums for Android! Download from Google Play

Remove widget margins in Relative layout?

Discussion in 'Application Development' started by RED_, Apr 3, 2012.

  1. RED_

    RED_ Well-Known Member
    Thread Starter

    Nov 13, 2010
    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 (Text):
    1. 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!


Share This Page